Skip to content

Commit a587b4a

Browse files
andypolsjescalada
andauthored
Update test/services/routes/auth.test.js
That makes sense - shows the intent Co-authored-by: Juan Escalada <[email protected]> Signed-off-by: Andy Pols <[email protected]>
1 parent 553232d commit a587b4a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/services/routes/auth.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,26 @@ describe('Authentication Routes', () => {
112112
}),
113113
).to.be.true;
114114
});
115+
116+
it('POST /gitAccount allows non-admin user to update their own gitAccount', async () => {
117+
const updateUserStub = sinon.stub(db, 'updateUser').resolves();
118+
119+
const res = await chai.request(newApp('bob')).post('/auth/gitAccount').send({
120+
username: 'bob',
121+
gitAccount: 'UPDATED_GIT_ACCOUNT',
122+
});
123+
124+
expect(res).to.have.status(200);
125+
expect(
126+
updateUserStub.calledOnceWith({
127+
username: 'bob',
128+
displayName: 'Bob Woodward',
129+
130+
admin: false,
131+
gitAccount: 'UPDATED_GIT_ACCOUNT',
132+
}),
133+
).to.be.true;
134+
});
135+
115136
});
116137
});

0 commit comments

Comments
 (0)