fix: Unknown Slack users should be able to search team accessible docs (#1049)

* fix: Unknown Slack users should be able to search team accessible docs

* test: fix flaky test

* test: remove obsolete snapshot

* lint

* flow

* fix: Spelling mistake
This commit is contained in:
Tom Moor
2019-09-22 11:52:15 -07:00
committed by GitHub
parent d46530a4a0
commit b1a1d24f9c
6 changed files with 179 additions and 111 deletions

View File

@ -12,7 +12,7 @@ afterAll(server.close);
describe('#users.list', async () => {
it('should return teams paginated user list', async () => {
const { admin } = await seed();
const { admin, user } = await seed();
const res = await server.post('/api/users.list', {
body: { token: admin.getJwtToken() },
@ -20,18 +20,24 @@ describe('#users.list', async () => {
const body = await res.json();
expect(res.status).toEqual(200);
expect(body).toMatchSnapshot();
expect(body.data.length).toEqual(2);
expect(body.data[0].id).toEqual(user.id);
expect(body.data[1].id).toEqual(admin.id);
});
it('should require admin for detailed info', async () => {
const { user } = await seed();
const { user, admin } = await seed();
const res = await server.post('/api/users.list', {
body: { token: user.getJwtToken() },
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body).toMatchSnapshot();
expect(body.data.length).toEqual(2);
expect(body.data[0].email).toEqual(undefined);
expect(body.data[1].email).toEqual(undefined);
expect(body.data[0].id).toEqual(user.id);
expect(body.data[1].id).toEqual(admin.id);
});
});