Skip to content

Commit 0633da3

Browse files
committed
fix: Return promise in put
This should probably be covered by the test suite in the future, however the problem was that when the writing of the changes takes time micro-analytics will not wait for it to finish. In the tests for micro-analytics were we mock out flat-file-db and add latency this breaks several tests.
1 parent 354f3ac commit 0633da3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ const observable = new Observable((observer) => {
2323

2424
module.exports = {
2525
put: (key, value) => {
26-
db.put(key, value)
2726
handlers.forEach(handler => {
2827
handler({key, value});
2928
})
29+
return db.put(key, value)
3030
},
3131
has: (key) => Promise.resolve(db.has(key)),
3232
keys: () => Promise.resolve(db.keys()),

0 commit comments

Comments
 (0)