Skip to content

Node.js based forum software built for the modern web

test: add a null field test

Barış Soner Uşaklı1fc91d5e751d
diff --git a/test/database/hash.js b/test/database/hash.js
index 571cf8bb95..55b75c0df6 100644
--- a/test/database/hash.js
+++ b/test/database/hash.js
@@ -117,6 +117,12 @@ describe('Hash methods', () => {
const result = await db.getObject('emptykey');
assert.deepStrictEqual(result, null);
});
+
+ it('should return null if a field is set to null', async () => {
+ await db.setObject('nullFieldTest', { baz: 'baz', foo: null });
+ const data = await db.getObjectFields('nullFieldTest', ['baz', 'foo']);
+ assert.deepStrictEqual(data, { baz: 'baz', foo: null });
+ });
});
describe('setObjectField()', () => {