From 05441e153e0a2fa14a345744160e2311568e83e2 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Sun, 28 Mar 2021 09:47:23 -0700 Subject: [PATCH] Got create, get all, and get ID for user lib unit tests --- test/unit/biz-logic/a02-users.lib-unit.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/unit/biz-logic/a02-users.lib-unit.js b/test/unit/biz-logic/a02-users.lib-unit.js index a06fe69..81c47f3 100644 --- a/test/unit/biz-logic/a02-users.lib-unit.js +++ b/test/unit/biz-logic/a02-users.lib-unit.js @@ -16,6 +16,7 @@ const UserLib = require('../../../src/lib/users') describe('#users', () => { let uut let sandbox + let testUserId = '' before(async () => { // Connect to the Mongo Database. @@ -122,6 +123,8 @@ describe('#users', () => { const { userData, token } = await uut.createUser(usrObj) + testUserId = userData._id + // Assert that the user model has the expected properties with expected values. assert.property(userData, 'type') assert.equal(userData.type, 'user') @@ -197,7 +200,15 @@ describe('#users', () => { }) it('should return the user model', async () => { - console.log('TODO') + const params = { id: testUserId } + const result = await uut.getUser(params) + // console.log('result: ', result) + + // Assert that the expected properties for the user model exist. + assert.property(result, 'type') + assert.property(result, '_id') + assert.property(result, 'email') + assert.property(result, 'name') }) }) })