From 89910f6ef17be38b59bc066d754793cc65a84624 Mon Sep 17 00:00:00 2001 From: Century Guo <648772021@qq.com> Date: Thu, 17 Jan 2019 22:25:55 +0800 Subject: [PATCH] test: add null query test case (#13) --- test/mysql.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/mysql.test.js b/test/mysql.test.js index 200f522..e5f41b4 100644 --- a/test/mysql.test.js +++ b/test/mysql.test.js @@ -84,6 +84,15 @@ describe('test/mysql.test.js', () => { assert(row.id === user.id); }); + it('should query one desc is NULL success', function* () { + const user = yield app.mysql.queryOne('select * from npm_auth where `desc` is NULL'); + assert(user); + assert(typeof user.user_id === 'string' && user.user_id); + + const row = yield app.mysql.get('npm_auth', { desc: null }); + assert(row.id === user.id); + }); + it('should query one not exists return null', function* () { let user = yield app.mysql.queryOne('select * from npm_auth where id = -1'); assert(!user);