Skip to content

Commit 2727214

Browse files
committed
SBERDOMA-102 added test case 'can count all' for admin in OrganizationEmployee
1 parent af5f44c commit 2727214

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

apps/condo/domains/organization/schema/OrganizationEmployee.test.js

+18
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,22 @@ describe('OrganizationEmployee', () => {
234234
expect(e.data).toEqual({ 'obj': null })
235235
}
236236
})
237+
238+
describe('admin', () => {
239+
it('can count all', async () => {
240+
const admin = await makeLoggedInAdminClient()
241+
const [organization] = await createTestOrganization(admin)
242+
const [role] = await createTestOrganizationEmployeeRole(admin, organization)
243+
const userClient1 = await makeClientWithNewRegisteredAndLoggedInUser()
244+
await createTestOrganizationEmployee(admin, organization, userClient1.user, role)
245+
const userClient2 = await makeClientWithNewRegisteredAndLoggedInUser()
246+
await createTestOrganizationEmployee(admin, organization, userClient2.user, role)
247+
248+
const countOfCreatedByAdmin = await OrganizationEmployee.count(admin, { createdBy: { id: admin.user.id } })
249+
expect(countOfCreatedByAdmin).toBeGreaterThan(2)
250+
251+
const countOfAll = await OrganizationEmployee.count(admin)
252+
expect(countOfAll).toBeGreaterThanOrEqual(countOfCreatedByAdmin)
253+
})
254+
})
237255
})

0 commit comments

Comments
 (0)