Skip to content

Commit

Permalink
SBERDOMA-102 added test case 'can count all' for admin in Organizatio…
Browse files Browse the repository at this point in the history
…nEmployee
  • Loading branch information
AntonAL committed May 18, 2021
1 parent af5f44c commit 2727214
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,22 @@ describe('OrganizationEmployee', () => {
expect(e.data).toEqual({ 'obj': null })
}
})

describe('admin', () => {
it('can count all', async () => {
const admin = await makeLoggedInAdminClient()
const [organization] = await createTestOrganization(admin)
const [role] = await createTestOrganizationEmployeeRole(admin, organization)
const userClient1 = await makeClientWithNewRegisteredAndLoggedInUser()
await createTestOrganizationEmployee(admin, organization, userClient1.user, role)
const userClient2 = await makeClientWithNewRegisteredAndLoggedInUser()
await createTestOrganizationEmployee(admin, organization, userClient2.user, role)

const countOfCreatedByAdmin = await OrganizationEmployee.count(admin, { createdBy: { id: admin.user.id } })
expect(countOfCreatedByAdmin).toBeGreaterThan(2)

const countOfAll = await OrganizationEmployee.count(admin)
expect(countOfAll).toBeGreaterThanOrEqual(countOfCreatedByAdmin)
})
})
})

0 comments on commit 2727214

Please sign in to comment.