From 680c9ae105805ce8efb504ea4d5f9f19842120c7 Mon Sep 17 00:00:00 2001 From: Sasha Date: Thu, 29 Mar 2018 22:46:04 -0400 Subject: [PATCH] Query user's db and not post's (#65) * Query user's db and not post's * Update users.js --- server/src/controllers/__tests__/users.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/controllers/__tests__/users.js b/server/src/controllers/__tests__/users.js index 19502f5c..fad70b9a 100644 --- a/server/src/controllers/__tests__/users.js +++ b/server/src/controllers/__tests__/users.js @@ -97,7 +97,7 @@ test('deleteUser deletes a user', async () => { const firstArg = firstCall[0] const {user} = firstArg expect(user).toEqual(safeUser(testUser)) - const userFromDb = await db.getPost(user.id) + const userFromDb = await db.getUser(user.id) expect(userFromDb).not.toBeDefined() }) @@ -115,7 +115,7 @@ test('deleteUser will 404 if made to a non-existing user', async () => { }) test('deleteUser will 403 if not made by the author', async () => { - const testUser = await db.insertPost(generate.userData()) + const testUser = await db.insertUser(generate.userData()) const {req, res} = setup() req.params = {id: testUser.id} @@ -125,6 +125,6 @@ test('deleteUser will 403 if not made by the author', async () => { expect(res.status).toHaveBeenCalledTimes(1) expect(res.status).toHaveBeenCalledWith(403) expect(res.send).toHaveBeenCalledTimes(1) - const userFromDb = await db.getPost(testUser.id) + const userFromDb = await db.getUser(testUser.id) expect(userFromDb).toEqual(testUser) })