Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • web-et-numerique/factory/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server
1 result
Show changes
Commits on Source (2)
......@@ -94,7 +94,7 @@ describe('userRegistryService', () => {
expect(mailerSpy).toHaveBeenCalledTimes(1);
expect(response).toBe(onlineMediationMockData.length);
});
it('should send the mail and reset db', async () => {
it('should NOT send the mail and reset db', async () => {
mockConfigService.isProdConf.mockReturnValueOnce(false);
mockOnlineMediationModel.exec.mockResolvedValueOnce(onlineMediationMockData);
mockOnlineMediationModel.deleteMany.mockReturnThis();
......
......@@ -137,7 +137,7 @@ describe('PersonalOffersController', () => {
});
});
describe('update personal offer', () => {
describe('delete personal offer', () => {
it('should get deleted personal offer', async () => {
expect(await personalOffersController.delete('2345ba0e2ab5775cfc01ed4d')).toEqual(personalOffersDataMock[1]);
});
......
......@@ -303,6 +303,7 @@ describe('StructuresService', () => {
mockStructureModel.exec.mockResolvedValue([
{
_id: '6903ba0e2ab5775cfc01ed4d',
structureName: "L'Atelier Numérique",
structureId: '6903ba0e2ab5775cfc01ed4d',
structureType: null,
digitalCultureSecurity: ['2', '5', '9', '28', '34', '39', '42', '51', '52', '54', '65', '96', '97', '98'],
......@@ -317,7 +318,6 @@ describe('StructuresService', () => {
freeWorkShop: 'Non',
createdAt: '2020-11-16T09:30:00.000Z',
updatedAt: '2021-04-12T08:48:00.000Z',
structureName: "L'Atelier Numérique",
description:
"L'Atelier Numérique est l'Espace Public Numérique des Centres Sociaux de Rillieux-la-Pape, ayant pour mission la médiation numérique pour toutes et tous.",
lockdownActivity:
......@@ -371,14 +371,6 @@ describe('StructuresService', () => {
},
]);
it('should find 1 structure', async () => {
const res = await structureService.searchForStructures('a', [[{ nbPrinters: '1' }]]);
expect(res.length).toBe(1);
});
it('should find 1 structure', async () => {
const res = await structureService.searchForStructures('a', [[{ nbPrinters: '1' }, { onlineProcedures: 'caf' }]]);
expect(res.length).toBe(1);
});
it('should find 0 structure with personalOffer', async () => {
const res = await structureService.searchForStructures('a', [[{ onlineProcedures: 'caf' }]], null, true);
expect(res.length).toBe(0);
......
......@@ -9,6 +9,7 @@ import { Employer } from '../schemas/employer.schema';
import { EmployerService } from '../services/employer.service';
import { UsersService } from '../services/users.service';
import { EmployerController } from './employer.controller';
import { CreateEmployerDto } from '../dto/create-employer.dto';
describe('EmployerController', () => {
let employerController: EmployerController;
......@@ -93,40 +94,6 @@ describe('EmployerController', () => {
});
});
// describe('deleteEmployer', () => {
// it('should delete employer `Metro`', async () => {
// const employer: Employer = {
// name: 'Metro',
// validated: true,
// };
// const employerToRemove: CreateEmployerDto = {
// name: 'Metro',
// };
// employerServiceMock.findByName.mockResolvedValueOnce(employer);
// employerServiceMock.deleteByName.mockResolvedValueOnce({
// ok: 1,
// n: 1,
// deletedCount: 1,
// });
// const deleteEmployer = await controller.deleteEmployer(employerToRemove);
// expect(deleteEmployer.name).toBe('Metro');
// expect(deleteEmployer.validated).toBe(true);
// });
// it('should throw error on unexisting employer `Metro`', async () => {
// const employerToRemove: CreateEmployerDto = {
// name: 'Metro',
// };
// employerServiceMock.deleteByName.mockResolvedValueOnce(null);
// try {
// await controller.deleteEmployer(employerToRemove);
// expect(true).toBe(false);
// } catch (e) {
// expect(e.message).toBe('Employer does not exist');
// expect(e.status).toBe(404);
// }
// });
// });
describe('resetES', () => {
it('should reset search index', async () => {
employerServiceMock.initEmployerIndex.mockResolvedValueOnce([
......
......@@ -54,15 +54,9 @@ describe('EmployerSearchService Search cases', () => {
}, 10000);
it('should be defined', async () => {
// await new Promise((r) => setTimeout(r, 9000));
expect(employerSearchService).toBeDefined();
});
// it('should index structures', async () => {
// // but we still need to wait the refresh to be done
// await new Promise((r) => setTimeout(r, 2000));
// }, 10000);
it('should find Metro', async () => {
const res = await employerSearchService.search('Metro');
expect(res[0].name).toBe('Metro');
......
......@@ -133,7 +133,7 @@ describe('EmployerService', () => {
},
]);
const reply = await employerService.findAllUnvalidated();
expect(reply[0].validated).toBeFalsy;
expect(reply[0].validated).toBeFalsy();
});
it('finds all validated employers', async () => {
......
......@@ -146,7 +146,7 @@ describe('JobsService', () => {
},
]);
const reply = await jobsService.findAllUnvalidated();
expect(reply[0].validated).toBeFalsy;
expect(reply[0].validated).toBeFalsy();
});
it('findByName', async () => {
......@@ -335,7 +335,7 @@ describe('JobsService', () => {
const reply = await jobsService.deleteOneId('623aed68c5d45b6fbbaa7e60');
expect(reply).toBe('toto');
});
it('should delete', async () => {
it('should not be able to delete', async () => {
mockJobModel.exec.mockResolvedValueOnce(null);
try {
await jobsService.deleteOneId('623aed68c5d45b6fbbaa7e60');
......
......@@ -222,9 +222,6 @@ describe('UsersService', () => {
it('should return false with "azertyu1" (no special character)', () => {
expect(usersService.isStrongPassword('azertyu1')).toBe(false);
});
it('should return false with "azertyu1" (no special character)', () => {
expect(usersService.isStrongPassword('azertyu1')).toBe(false);
});
it('should return false with "azer" (too short)', () => {
expect(usersService.isStrongPassword('azer')).toBe(false);
});
......@@ -303,34 +300,6 @@ describe('UsersService', () => {
});
});
describe('changeUserPassword', () => {
// TODO implement correct tests
});
describe('changeUserEmail', () => {
// TODO implement correct tests
});
describe('sendResetPasswordEmail', () => {
// TODO implement correct tests
});
describe('validatePasswordResetToken', () => {
// TODO implement correct tests
});
it('should find All Unattacheduser', async () => {
return;
});
it('should find attached users', async () => {
return;
});
it('should find UnVerified Users', async () => {
return;
});
describe('addPersonalOffer', () => {
const personalOfferDocumentMock: PersonalOfferDocument = personalOffersDataMock[0] as PersonalOfferDocument;
it('should add personal offer to the user', async () => {
......@@ -380,38 +349,6 @@ describe('UsersService', () => {
await usersService.replaceEmployers(employersMockData[0], employersMockData[1]);
expect(spyer).toHaveBeenCalledTimes(1);
});
it('should return true if a user is linked to a given employer', async () => {
return;
});
it('should fetch users attached to a given employer', async () => {
return;
});
it('should populate an employer with a list of attached users', async () => {
return;
});
it("should update user's employer", async () => {
return;
});
});
describe('user job', () => {
it('should replace job with a new one', async () => {
return;
});
it('should return true if a user is linked to a given job', async () => {
return;
});
it('should fetch users attached to a given job', async () => {
return;
});
it('should populate an job with a list of attached users', async () => {
return;
});
it("should update user's job", async () => {
return;
});
});
describe('updateUserProfile', () => {
......
import * as request from 'supertest';
import { Test } from '@nestjs/testing';
import { AppModule } from './../src/app.module';
import { INestApplication } from '@nestjs/common';
describe('AppController (e2e)', () => {
let app: INestApplication;
beforeAll(async () => {
const moduleFixture = await Test.createTestingModule({
imports: [AppModule],
}).compile();
app = moduleFixture.createNestApplication();
await app.init();
});
it('/ (GET)', () => {
return request(app.getHttpServer()).get('/').expect(200).expect('Hello World!');
});
});