fix: Suspended users showing in group and collection member management (#1302)

* fix: Suspended users showing in group and collection member management

* test
This commit is contained in:
Tom Moor
2020-06-11 08:48:47 -07:00
committed by GitHub
parent d7766280a9
commit 1d8c3f3faf
4 changed files with 62 additions and 6 deletions

View File

@ -14,6 +14,13 @@ describe('#users.list', async () => {
it('should allow filtering by user name', async () => {
const user = await buildUser({ name: 'Tester' });
// suspended user should not be returned
await buildUser({
name: 'Tester',
teamId: user.teamId,
suspendedAt: new Date(),
});
const res = await server.post('/api/users.list', {
body: {
query: 'test',
@ -27,6 +34,27 @@ describe('#users.list', async () => {
expect(body.data[0].id).toEqual(user.id);
});
it('should allow including suspended', async () => {
const user = await buildUser({ name: 'Tester' });
await buildUser({
name: 'Tester',
teamId: user.teamId,
suspendedAt: new Date(),
});
const res = await server.post('/api/users.list', {
body: {
query: 'test',
includeSuspended: true,
token: user.getJwtToken(),
},
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.data.length).toEqual(2);
});
it('should return teams paginated user list', async () => {
const { admin, user } = await seed();