🐛Do not show anonymous user is the user list everywhere on UI (#182)

* 🐛Do not show anonymous user is the user list everywhere on UI
This commit is contained in:
Anton Shepilov
2023-09-01 15:56:56 +02:00
committed by GitHub
parent 1eb0df97f1
commit c77bdbf99d
7 changed files with 62 additions and 15 deletions
@@ -3,6 +3,7 @@ import { init, TestPlatform } from "../setup";
import { TestDbService } from "../utils.prepare.db";
import { v1 as uuidv1 } from "uuid";
import { CompanyLimitsEnum } from "../../../src/services/user/web/types";
import TestHelpers from "../common/common_test_helpers";
describe("The /users API", () => {
const url = "/internal/services/users/v1";
@@ -209,8 +210,32 @@ describe("The /users API", () => {
expect(response.statusCode).toBe(200);
const json = response.json();
expect(json).toMatchObject({ resources: expect.any(Array) });
const resources = json.resources;
});
it("shouldn't return anonymous accounts ", async () => {
const oneUser = await TestHelpers.getInstance(platform, true);
const response = await platform.app.inject({
method: "GET",
url: `${url}/users`,
headers: {
authorization: `Bearer ${oneUser.jwt}`,
},
query: {
search: "anon",
company_ids: oneUser.workspace.company_id
},
});
expect(response.statusCode).toBe(200);
const json = response.json();
expect(json).toMatchObject({ resources: expect.any(Array) });
const resources = json.resources;
console.log(resources);
expect(resources.length).toBe(0);
});
});
describe("The GET /users/:user_id/companies route", () => {