mirror of
https://gitlab.com/mobicoop/v3/service/auth.git
synced 2026-01-31 12:20:45 +00:00
test authorization module
This commit is contained in:
@@ -11,7 +11,7 @@ describe('AuthenticationRepository', () => {
|
|||||||
let prismaService: PrismaService;
|
let prismaService: PrismaService;
|
||||||
let authenticationRepository: AuthenticationRepository;
|
let authenticationRepository: AuthenticationRepository;
|
||||||
|
|
||||||
const createAuths = async (nbToCreate = 10) => {
|
const createAuthentications = async (nbToCreate = 10) => {
|
||||||
for (let i = 0; i < nbToCreate; i++) {
|
for (let i = 0; i < nbToCreate; i++) {
|
||||||
await prismaService.auth.create({
|
await prismaService.auth.create({
|
||||||
data: {
|
data: {
|
||||||
@@ -52,14 +52,14 @@ describe('AuthenticationRepository', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return a data array with 8 auths', async () => {
|
it('should return a data array with 8 auths', async () => {
|
||||||
await createAuths(8);
|
await createAuthentications(8);
|
||||||
const auths = await authenticationRepository.findAll();
|
const auths = await authenticationRepository.findAll();
|
||||||
expect(auths.data.length).toBe(8);
|
expect(auths.data.length).toBe(8);
|
||||||
expect(auths.total).toBe(8);
|
expect(auths.total).toBe(8);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a data array limited to 10 authentications', async () => {
|
it('should return a data array limited to 10 authentications', async () => {
|
||||||
await createAuths(20);
|
await createAuthentications(20);
|
||||||
const auths = await authenticationRepository.findAll();
|
const auths = await authenticationRepository.findAll();
|
||||||
expect(auths.data.length).toBe(10);
|
expect(auths.data.length).toBe(10);
|
||||||
expect(auths.total).toBe(20);
|
expect(auths.total).toBe(20);
|
||||||
|
|||||||
Reference in New Issue
Block a user