Skip to content

Commit 059cb47

Browse files
committed
Make get in dbMock throw on non existing key
The flat-file-adapter expects this behaviour from flat-file-db.
1 parent 5b6fb0a commit 059cb47

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/utils.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ const DB = () => {
88

99
return {
1010
sync: () => ({
11-
get: (key) => data[key],
11+
get: (key) => {
12+
if (!{}.hasOwnProperty.call(data, key)) {
13+
throw new Error('non-existing-key')
14+
}
15+
return data[key]
16+
},
1217
put: (key, val, cb) => {
1318
setTimeout(() => {
1419
data[key] = val

0 commit comments

Comments
 (0)