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 (3)
Showing
with 628 additions and 716 deletions
...@@ -4,8 +4,13 @@ module.exports = { ...@@ -4,8 +4,13 @@ module.exports = {
project: true, project: true,
sourceType: 'module', sourceType: 'module',
}, },
plugins: ['@typescript-eslint/eslint-plugin'], plugins: ['@typescript-eslint/eslint-plugin', 'jest'],
extends: ['plugin:@typescript-eslint/recommended', 'prettier/@typescript-eslint', 'plugin:prettier/recommended'], extends: [
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
'plugin:jest/recommended',
],
root: true, root: true,
env: { env: {
node: true, node: true,
...@@ -16,5 +21,7 @@ module.exports = { ...@@ -16,5 +21,7 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off', '@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'warn', '@typescript-eslint/no-explicit-any': 'warn',
'jest/no-conditional-expect': 'off',
}, },
}; };
source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"doc": "./node_modules/.bin/compodoc compodoc -p tsconfig.json -s -n 'Resin api documentation'", "doc": "./node_modules/.bin/compodoc compodoc -p tsconfig.json -s -n 'Resin api documentation'",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"init-db": "node ./scripts/init-db.js", "init-db": "node ./scripts/init-db.js",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", "lint": "eslint src test -c .eslintrc.js --fix",
"migrate:create": "migrate create --template-file ./src/migrations/migrations-utils/template.ts --migrations-dir=\"./src/migrations/scripts\" --compiler=\"ts:./src/migrations/migrations-utils/ts-compiler.js\"", "migrate:create": "migrate create --template-file ./src/migrations/migrations-utils/template.ts --migrations-dir=\"./src/migrations/scripts\" --compiler=\"ts:./src/migrations/migrations-utils/ts-compiler.js\"",
"migrate:down": "migrate --migrations-dir=\"./src/migrations/scripts\" --compiler=\"ts:./src/migrations/migrations-utils/ts-compiler.js\" down", "migrate:down": "migrate --migrations-dir=\"./src/migrations/scripts\" --compiler=\"ts:./src/migrations/migrations-utils/ts-compiler.js\" down",
"migrate:up": "migrate --migrations-dir=\"./src/migrations/scripts\" --compiler=\"ts:./src/migrations/migrations-utils/ts-compiler.js\" up", "migrate:up": "migrate --migrations-dir=\"./src/migrations/scripts\" --compiler=\"ts:./src/migrations/migrations-utils/ts-compiler.js\" up",
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
"class-validator": "^0.13.2", "class-validator": "^0.13.2",
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"ejs": "^3.1.8", "ejs": "^3.1.8",
"eslint-plugin-jest": "^27.6.1",
"form-data": "^4.0.0", "form-data": "^4.0.0",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"luxon": "^1.25.0", "luxon": "^1.25.0",
......
...@@ -225,8 +225,8 @@ describe('AdminController', () => { ...@@ -225,8 +225,8 @@ describe('AdminController', () => {
userId: mockUserId, userId: mockUserId,
employerId: String(mockEmployer._id), employerId: String(mockEmployer._id),
}); });
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
expect(spyer).toBeCalledWith(mockUserId, mockEmployer); expect(spyer).toHaveBeenCalledWith(mockUserId, mockEmployer);
expect(reply).toBeTruthy(); expect(reply).toBeTruthy();
}); });
...@@ -246,7 +246,7 @@ describe('AdminController', () => { ...@@ -246,7 +246,7 @@ describe('AdminController', () => {
}); });
expect(true).toBe(false); expect(true).toBe(false);
} catch (e) { } catch (e) {
expect(spyer).toBeCalledTimes(0); expect(spyer).toHaveBeenCalledTimes(0);
expect(e.message).toBe('Employer does not exist'); expect(e.message).toBe('Employer does not exist');
expect(e.status).toBe(400); expect(e.status).toBe(400);
} }
...@@ -268,7 +268,7 @@ describe('AdminController', () => { ...@@ -268,7 +268,7 @@ describe('AdminController', () => {
}); });
expect(true).toBe(false); expect(true).toBe(false);
} catch (e) { } catch (e) {
expect(spyer).toBeCalledTimes(0); expect(spyer).toHaveBeenCalledTimes(0);
expect(e.message).toBe('User does not exist'); expect(e.message).toBe('User does not exist');
expect(e.status).toBe(400); expect(e.status).toBe(400);
} }
...@@ -289,8 +289,8 @@ describe('AdminController', () => { ...@@ -289,8 +289,8 @@ describe('AdminController', () => {
userId: mockUserId, userId: mockUserId,
jobId: String(mockJob._id), jobId: String(mockJob._id),
}); });
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
expect(spyer).toBeCalledWith(mockUserId, mockJob); expect(spyer).toHaveBeenCalledWith(mockUserId, mockJob);
expect(reply).toBeTruthy(); expect(reply).toBeTruthy();
}); });
...@@ -310,7 +310,7 @@ describe('AdminController', () => { ...@@ -310,7 +310,7 @@ describe('AdminController', () => {
}); });
expect(true).toBe(false); expect(true).toBe(false);
} catch (e) { } catch (e) {
expect(spyer).toBeCalledTimes(0); expect(spyer).toHaveBeenCalledTimes(0);
expect(e.message).toBe('Job does not exist'); expect(e.message).toBe('Job does not exist');
expect(e.status).toBe(400); expect(e.status).toBe(400);
} }
...@@ -332,7 +332,7 @@ describe('AdminController', () => { ...@@ -332,7 +332,7 @@ describe('AdminController', () => {
}); });
expect(true).toBe(false); expect(true).toBe(false);
} catch (e) { } catch (e) {
expect(spyer).toBeCalledTimes(0); expect(spyer).toHaveBeenCalledTimes(0);
expect(e.message).toBe('User does not exist'); expect(e.message).toBe('User does not exist');
expect(e.status).toBe(400); expect(e.status).toBe(400);
} }
......
...@@ -33,7 +33,7 @@ describe('ContactController', () => { ...@@ -33,7 +33,7 @@ describe('ContactController', () => {
it('should call sendMessage', async () => { it('should call sendMessage', async () => {
const spyer = jest.spyOn(contactServiceMock, 'sendMessage'); const spyer = jest.spyOn(contactServiceMock, 'sendMessage');
await contactController.sendContactMessage({ contactMessage: new ContactMessage() }); await contactController.sendContactMessage({ contactMessage: new ContactMessage() });
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
expect(spyer).toBeCalledWith(new ContactMessage()); expect(spyer).toHaveBeenCalledWith(new ContactMessage());
}); });
}); });
...@@ -61,7 +61,7 @@ describe('NewsletterService', () => { ...@@ -61,7 +61,7 @@ describe('NewsletterService', () => {
}); });
describe('newsletterSubscribe', () => { describe('newsletterSubscribe', () => {
it('it should add subscription for email test2@test.com even if it exists', async () => { it('should add subscription for email test2@test.com even if it exists', async () => {
const _doc = { _id: 'a1aaaaa1a1', email: 'test2@test.com' } as INewsletterSubscription; const _doc = { _id: 'a1aaaaa1a1', email: 'test2@test.com' } as INewsletterSubscription;
mailchimp.lists.setListMember.mockResolvedValueOnce({ email_address: 'test2@test.com' }); mailchimp.lists.setListMember.mockResolvedValueOnce({ email_address: 'test2@test.com' });
mailchimp.lists.updateListMemberTags.mockResolvedValueOnce({}); mailchimp.lists.updateListMemberTags.mockResolvedValueOnce({});
...@@ -73,7 +73,7 @@ describe('NewsletterService', () => { ...@@ -73,7 +73,7 @@ describe('NewsletterService', () => {
const subscription = await newsletterService.newsletterSubscribe('test2@test.com'); const subscription = await newsletterService.newsletterSubscribe('test2@test.com');
expect(subscription).toEqual(_doc); expect(subscription).toEqual(_doc);
}); });
it('it should add a subscription for email test2@test.com', async () => { it('should add a subscription for email test2@test.com', async () => {
const result = { email: 'test2@test.com' } as INewsletterSubscription; const result = { email: 'test2@test.com' } as INewsletterSubscription;
const _doc = { _id: 'a1aaaaa1a1', email: 'test2@test.com' }; const _doc = { _id: 'a1aaaaa1a1', email: 'test2@test.com' };
mailchimp.lists.setListMember.mockResolvedValueOnce({ email_address: 'test2@test.com' }); mailchimp.lists.setListMember.mockResolvedValueOnce({ email_address: 'test2@test.com' });
...@@ -87,7 +87,7 @@ describe('NewsletterService', () => { ...@@ -87,7 +87,7 @@ describe('NewsletterService', () => {
const subscription = await newsletterService.newsletterSubscribe('test2@test.com'); const subscription = await newsletterService.newsletterSubscribe('test2@test.com');
expect(subscription).toEqual(_doc); expect(subscription).toEqual(_doc);
}); });
it('it should return error if mailchimp 400 issue', async () => { it('should return error if mailchimp 400 issue', async () => {
const result = { email: 'test2@test.com' } as INewsletterSubscription; const result = { email: 'test2@test.com' } as INewsletterSubscription;
const _doc = { _id: 'a1aaaaa1a1', email: 'test2@test.com' }; const _doc = { _id: 'a1aaaaa1a1', email: 'test2@test.com' };
mailchimp.lists.setListMember.mockRejectedValueOnce({ status: 400 }); mailchimp.lists.setListMember.mockRejectedValueOnce({ status: 400 });
...@@ -106,7 +106,7 @@ describe('NewsletterService', () => { ...@@ -106,7 +106,7 @@ describe('NewsletterService', () => {
expect(e.status).toEqual(HttpStatus.BAD_REQUEST); expect(e.status).toEqual(HttpStatus.BAD_REQUEST);
} }
}); });
it('it should return error if mailchimp 500 issue', async () => { it('should return error if mailchimp 500 issue', async () => {
const result = { email: 'test2@test.com' } as INewsletterSubscription; const result = { email: 'test2@test.com' } as INewsletterSubscription;
const _doc = { _id: 'a1aaaaa1a1', email: 'test2@test.com' }; const _doc = { _id: 'a1aaaaa1a1', email: 'test2@test.com' };
mailchimp.lists.setListMember.mockRejectedValueOnce({ status: 500 }); mailchimp.lists.setListMember.mockRejectedValueOnce({ status: 500 });
...@@ -127,7 +127,7 @@ describe('NewsletterService', () => { ...@@ -127,7 +127,7 @@ describe('NewsletterService', () => {
}); });
}); });
describe('newsletterUnsubscribe', () => { describe('newsletterUnsubscribe', () => {
it('it should not remove subscription for email test@test.com : does not exist', async () => { it('should not remove subscription for email test@test.com : does not exist', async () => {
mailchimp.lists.getListMember.mockRejectedValueOnce({ status: 404 }); mailchimp.lists.getListMember.mockRejectedValueOnce({ status: 404 });
mockNewsletterModel.findOne.mockReturnThis(); mockNewsletterModel.findOne.mockReturnThis();
mockNewsletterModel.exec.mockResolvedValueOnce(undefined); mockNewsletterModel.exec.mockResolvedValueOnce(undefined);
...@@ -140,7 +140,7 @@ describe('NewsletterService', () => { ...@@ -140,7 +140,7 @@ describe('NewsletterService', () => {
expect(e.status).toEqual(HttpStatus.NOT_FOUND); expect(e.status).toEqual(HttpStatus.NOT_FOUND);
} }
}); });
it('it should remove a subscription for email test2@test.com', async () => { it('should remove a subscription for email test2@test.com', async () => {
const _doc = { _id: 'a1aaaaa1a1', email: 'test2@test.com' }; const _doc = { _id: 'a1aaaaa1a1', email: 'test2@test.com' };
mailchimp.lists.getListMember.mockResolvedValueOnce({ email_address: 'test2@test.com' }); mailchimp.lists.getListMember.mockResolvedValueOnce({ email_address: 'test2@test.com' });
mailchimp.lists.setListMember.mockResolvedValueOnce({ email_address: 'test2@test.com' }); mailchimp.lists.setListMember.mockResolvedValueOnce({ email_address: 'test2@test.com' });
...@@ -158,13 +158,13 @@ describe('NewsletterService', () => { ...@@ -158,13 +158,13 @@ describe('NewsletterService', () => {
}); });
describe('findOne', () => { describe('findOne', () => {
it('it should not find a subscription with email test@test.com', async () => { it('should not find a subscription with email test@test.com', async () => {
mockNewsletterModel.findOne.mockReturnThis(); mockNewsletterModel.findOne.mockReturnThis();
mockNewsletterModel.exec.mockResolvedValueOnce(undefined); mockNewsletterModel.exec.mockResolvedValueOnce(undefined);
const findOneEmail = await newsletterService.findOne('test@test.com'); const findOneEmail = await newsletterService.findOne('test@test.com');
expect(findOneEmail).toEqual(undefined); expect(findOneEmail).toEqual(undefined);
}); });
it('it should find a subscription with email test2@test.com', async () => { it('should find a subscription with email test2@test.com', async () => {
const _doc = { _id: 'a1aaaaa1a1', email: 'test2@test.com' } as INewsletterSubscription; const _doc = { _id: 'a1aaaaa1a1', email: 'test2@test.com' } as INewsletterSubscription;
mockNewsletterModel.findOne.mockReturnThis(); mockNewsletterModel.findOne.mockReturnThis();
mockNewsletterModel.exec.mockResolvedValueOnce(_doc); mockNewsletterModel.exec.mockResolvedValueOnce(_doc);
...@@ -173,7 +173,7 @@ describe('NewsletterService', () => { ...@@ -173,7 +173,7 @@ describe('NewsletterService', () => {
}); });
}); });
describe('findAll', () => { describe('findAll', () => {
it('it should find all', async () => { it('should find all', async () => {
const _docs = [{ _id: 'a1aaaaa1a1', email: 'test2@test.com' } as INewsletterSubscription]; const _docs = [{ _id: 'a1aaaaa1a1', email: 'test2@test.com' } as INewsletterSubscription];
mockNewsletterModel.find.mockReturnThis(); mockNewsletterModel.find.mockReturnThis();
mockNewsletterModel.exec.mockResolvedValueOnce(_docs); mockNewsletterModel.exec.mockResolvedValueOnce(_docs);
...@@ -194,7 +194,7 @@ describe('NewsletterService', () => { ...@@ -194,7 +194,7 @@ describe('NewsletterService', () => {
mockNewsletterModel.findOne.mockReturnThis(); mockNewsletterModel.findOne.mockReturnThis();
mockNewsletterModel.exec.mockResolvedValueOnce(result).mockResolvedValueOnce(null); mockNewsletterModel.exec.mockResolvedValueOnce(result).mockResolvedValueOnce(null);
await newsletterService.updateNewsletterSubscription(); await newsletterService.updateNewsletterSubscription();
expect(mockNewsletterModel.findOne).toBeCalledTimes(2); expect(mockNewsletterModel.findOne).toHaveBeenCalledTimes(2);
// Remove subscription is not tested // Remove subscription is not tested
// expect(spyerDelete).toBeCalledTimes(1); // expect(spyerDelete).toBeCalledTimes(1);
}); });
......
...@@ -37,22 +37,22 @@ describe('ParametersController', () => { ...@@ -37,22 +37,22 @@ describe('ParametersController', () => {
it('should call getParameters', async () => { it('should call getParameters', async () => {
const spyer = jest.spyOn(parametersServiceMock, 'getParameters'); const spyer = jest.spyOn(parametersServiceMock, 'getParameters');
await parametersController.getParameters(); await parametersController.getParameters();
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
describe('setParameterLockdownInfoDisplay', () => { describe('setParameterLockdownInfoDisplay', () => {
const spyer = jest.spyOn(parametersServiceMock, 'setParameterLockdownInfoDisplay'); const spyer = jest.spyOn(parametersServiceMock, 'setParameterLockdownInfoDisplay');
afterEach(() => spyer.mockClear()); afterEach(() => spyer.mockClear());
it('should call setParameterLockdownInfoDisplay(false) ', async () => { it('should call setParameterLockdownInfoDisplay(false)', async () => {
await parametersController.setParameterLockdownInfoDisplay({ lockdownInfoDisplay: false }); await parametersController.setParameterLockdownInfoDisplay({ lockdownInfoDisplay: false });
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
expect(spyer).toBeCalledWith(false); expect(spyer).toHaveBeenCalledWith(false);
}); });
it('should call setParameterLockdownInfoDisplay(true)', async () => { it('should call setParameterLockdownInfoDisplay(true)', async () => {
await parametersController.setParameterLockdownInfoDisplay({ lockdownInfoDisplay: true }); await parametersController.setParameterLockdownInfoDisplay({ lockdownInfoDisplay: true });
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
expect(spyer).toBeCalledWith(true); expect(spyer).toHaveBeenCalledWith(true);
}); });
}); });
}); });
...@@ -40,7 +40,7 @@ describe('ParametersService', () => { ...@@ -40,7 +40,7 @@ describe('ParametersService', () => {
parametersModelMock.exec.mockResolvedValueOnce({ lockdownInfoDisplay: false }); parametersModelMock.exec.mockResolvedValueOnce({ lockdownInfoDisplay: false });
const result = await parametersService.getParameters(); const result = await parametersService.getParameters();
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
expect(result).toEqual({ lockdownInfoDisplay: false }); expect(result).toEqual({ lockdownInfoDisplay: false });
}); });
...@@ -56,7 +56,7 @@ describe('ParametersService', () => { ...@@ -56,7 +56,7 @@ describe('ParametersService', () => {
expect(error.message).toBe('Parameters not found'); expect(error.message).toBe('Parameters not found');
expect(error.status).toBe(HttpStatus.NOT_FOUND); expect(error.status).toBe(HttpStatus.NOT_FOUND);
} }
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
}); });
...@@ -67,7 +67,7 @@ describe('ParametersService', () => { ...@@ -67,7 +67,7 @@ describe('ParametersService', () => {
parametersModelMock.exec.mockResolvedValueOnce({ lockdownInfoDisplay: false, save: jest.fn() }); parametersModelMock.exec.mockResolvedValueOnce({ lockdownInfoDisplay: false, save: jest.fn() });
const result = await parametersService.setParameterLockdownInfoDisplay(true); const result = await parametersService.setParameterLockdownInfoDisplay(true);
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
expect(result.lockdownInfoDisplay).toEqual(true); expect(result.lockdownInfoDisplay).toEqual(true);
}); });
...@@ -83,7 +83,7 @@ describe('ParametersService', () => { ...@@ -83,7 +83,7 @@ describe('ParametersService', () => {
expect(error.message).toBe('Parameters not found'); expect(error.message).toBe('Parameters not found');
expect(error.status).toBe(HttpStatus.NOT_FOUND); expect(error.status).toBe(HttpStatus.NOT_FOUND);
} }
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
}); });
}); });
...@@ -104,10 +104,10 @@ describe('StructuresImportService', () => { ...@@ -104,10 +104,10 @@ describe('StructuresImportService', () => {
await structuresImportService.importDataGouvStructures(); await structuresImportService.importDataGouvStructures();
expect(httpServiceMock.get).toBeCalled(); expect(httpServiceMock.get).toHaveBeenCalled();
expect(formatToResinSchemaSpy).toBeCalled(); expect(formatToResinSchemaSpy).toHaveBeenCalled();
expect(doesAlreadyExistSpy).toBeCalled(); expect(doesAlreadyExistSpy).toHaveBeenCalled();
expect(saveSpy).toBeCalled(); expect(saveSpy).toHaveBeenCalled();
}); });
}); });
......
...@@ -290,9 +290,9 @@ describe('StructuresService', () => { ...@@ -290,9 +290,9 @@ describe('StructuresService', () => {
it('should Initiate structure index', async () => { it('should Initiate structure index', async () => {
await structureService.initiateStructureIndex(); await structureService.initiateStructureIndex();
expect(mockStructuresSearchService.createStructureIndex).toBeCalledTimes(1); expect(mockStructuresSearchService.createStructureIndex).toHaveBeenCalledTimes(1);
expect(mockStructuresSearchService.dropIndex).toBeCalledTimes(1); expect(mockStructuresSearchService.dropIndex).toHaveBeenCalledTimes(1);
expect(mockStructuresSearchService.indexStructure).toBeCalledTimes(1); expect(mockStructuresSearchService.indexStructure).toHaveBeenCalledTimes(1);
}); });
describe('searchForStructures', () => { describe('searchForStructures', () => {
...@@ -622,7 +622,7 @@ describe('StructuresService', () => { ...@@ -622,7 +622,7 @@ describe('StructuresService', () => {
mockStructureModel.findByIdAndUpdate.mockReturnThis(); mockStructureModel.findByIdAndUpdate.mockReturnThis();
mockStructureModel.exec.mockImplementation(() => null); mockStructureModel.exec.mockImplementation(() => null);
await structureService.restoreStructure('someId'); await structureService.restoreStructure('someId');
expect(mockStructureModel.findByIdAndUpdate).toBeCalled(); expect(mockStructureModel.findByIdAndUpdate).toHaveBeenCalled();
}); });
}); });
......
...@@ -551,7 +551,7 @@ export class StructuresService { ...@@ -551,7 +551,7 @@ export class StructuresService {
const communes = res.data.filter((commune) => commune.nomCommune == structure.address.commune); const communes = res.data.filter((commune) => commune.nomCommune == structure.address.commune);
if (communes.length) { if (communes.length) {
this.logger.debug(`Insee code ${communes[0].codeCommune} for ${structure.address.commune}`); this.logger.debug(`Insee code ${communes[0].codeCommune} for ${structure.address.commune}`);
inseeCode = res.data[0].codeCommune; inseeCode = communes[0].codeCommune;
} else { } else {
this.logger.warn( this.logger.warn(
`Commune not found for ${structure.address.commune} in ${JSON.stringify(res.data)} (${req})` `Commune not found for ${structure.address.commune} in ${JSON.stringify(res.data)} (${req})`
......
...@@ -130,7 +130,7 @@ describe('StructuresController', () => { ...@@ -130,7 +130,7 @@ describe('StructuresController', () => {
structure: structureDtoMock, structure: structureDtoMock,
}; };
await structuresController.create(structure); await structuresController.create(structure);
expect(mockStructureService.create).toBeCalled(); expect(mockStructureService.create).toHaveBeenCalled();
}); });
it('should update structure', async () => { it('should update structure', async () => {
...@@ -140,7 +140,7 @@ describe('StructuresController', () => { ...@@ -140,7 +140,7 @@ describe('StructuresController', () => {
dataShareConsentDate: null, dataShareConsentDate: null,
personalOffers: [], personalOffers: [],
}); });
expect(mockStructureService.update).toBeCalled(); expect(mockStructureService.update).toHaveBeenCalled();
}); });
it('should findAll', async () => { it('should findAll', async () => {
...@@ -160,13 +160,13 @@ describe('StructuresController', () => { ...@@ -160,13 +160,13 @@ describe('StructuresController', () => {
it('should search structure', async () => { it('should search structure', async () => {
await structuresController.search({ query: 'test', filters: [] }, null); await structuresController.search({ query: 'test', filters: [] }, null);
expect(mockStructureService.searchForStructures).toBeCalled(); expect(mockStructureService.searchForStructures).toHaveBeenCalled();
}); });
it('should reset Search Index', async () => { it('should reset Search Index', async () => {
await structuresController.resetES(); await structuresController.resetES();
expect(mockStructureService.updateAllDenormalizedFields).toBeCalled(); expect(mockStructureService.updateAllDenormalizedFields).toHaveBeenCalled();
expect(mockStructureService.initiateStructureIndex).toBeCalled(); expect(mockStructureService.initiateStructureIndex).toHaveBeenCalled();
}); });
it('should claim structure', async () => { it('should claim structure', async () => {
...@@ -207,7 +207,7 @@ describe('StructuresController', () => { ...@@ -207,7 +207,7 @@ describe('StructuresController', () => {
it('should search an address', async () => { it('should search an address', async () => {
await structuresController.searchAddress({ searchQuery: 'Rue Alphonse Daudet' }); await structuresController.searchAddress({ searchQuery: 'Rue Alphonse Daudet' });
expect(mockStructureService.searchAddress).toBeCalled(); expect(mockStructureService.searchAddress).toHaveBeenCalled();
}); });
describe('find(structureId)', () => { describe('find(structureId)', () => {
...@@ -294,8 +294,8 @@ describe('StructuresController', () => { ...@@ -294,8 +294,8 @@ describe('StructuresController', () => {
mockUsersService.findById.mockResolvedValue(mockUser); mockUsersService.findById.mockResolvedValue(mockUser);
mockUsersService.getPersonalOfferInStructure.mockReturnValue(null); mockUsersService.getPersonalOfferInStructure.mockReturnValue(null);
await structuresController.removeOwner('6093ba0e2ab5775cfc01ed3e', '63639058685ba134c32bc495'); await structuresController.removeOwner('6093ba0e2ab5775cfc01ed3e', '63639058685ba134c32bc495');
expect(mockUsersService.removeFromStructureLinked).toBeCalledTimes(1); expect(mockUsersService.removeFromStructureLinked).toHaveBeenCalledTimes(1);
expect(mockPersonalOffersService.delete).toBeCalledTimes(0); expect(mockPersonalOffersService.delete).toHaveBeenCalledTimes(0);
}); });
it('should remove structure link with offer', async () => { it('should remove structure link with offer', async () => {
...@@ -313,8 +313,8 @@ describe('StructuresController', () => { ...@@ -313,8 +313,8 @@ describe('StructuresController', () => {
}); });
await structuresController.removeOwner('6093ba0e2ab5775cfc01ed3e', '63639058685ba134c32bc495'); await structuresController.removeOwner('6093ba0e2ab5775cfc01ed3e', '63639058685ba134c32bc495');
expect(mockUsersService.removeFromStructureLinked).toBeCalled(); expect(mockUsersService.removeFromStructureLinked).toHaveBeenCalled();
expect(mockPersonalOffersService.delete).toBeCalled(); expect(mockPersonalOffersService.delete).toHaveBeenCalled();
}); });
it('should remove user from struct', async () => { it('should remove user from struct', async () => {
...@@ -322,7 +322,7 @@ describe('StructuresController', () => { ...@@ -322,7 +322,7 @@ describe('StructuresController', () => {
mockUsersService.findById.mockResolvedValue(mockUser); mockUsersService.findById.mockResolvedValue(mockUser);
mockUsersService.getPersonalOfferInStructure.mockReturnValue(null); mockUsersService.getPersonalOfferInStructure.mockReturnValue(null);
await structuresController.removeOwner('6093ba0e2ab5775cfc01ed3e', '63639058685ba134c32bc495'); await structuresController.removeOwner('6093ba0e2ab5775cfc01ed3e', '63639058685ba134c32bc495');
expect(mockUsersService.removeFromStructureLinked).toBeCalled(); expect(mockUsersService.removeFromStructureLinked).toHaveBeenCalled();
}); });
// test personal offers delete // test personal offers delete
...@@ -338,6 +338,6 @@ describe('StructuresController', () => { ...@@ -338,6 +338,6 @@ describe('StructuresController', () => {
it('should report any structure error', async () => { it('should report any structure error', async () => {
await structuresController.reportStructureError({ structureId: '6093ba0e2ab5775cfc01ed3e', content: null }); await structuresController.reportStructureError({ structureId: '6093ba0e2ab5775cfc01ed3e', content: null });
expect(mockStructureService.reportStructureError).toBeCalled(); expect(mockStructureService.reportStructureError).toHaveBeenCalled();
}); });
}); });
...@@ -59,7 +59,7 @@ describe('EmployerController', () => { ...@@ -59,7 +59,7 @@ describe('EmployerController', () => {
}); });
describe('findAll', () => { describe('findAll', () => {
it('should return two elements ', async () => { it('should return two elements', async () => {
employerServiceMock.findAll.mockResolvedValueOnce([ employerServiceMock.findAll.mockResolvedValueOnce([
{ {
_id: new Types.ObjectId('6231aefe76598527c8d0b5a7'), _id: new Types.ObjectId('6231aefe76598527c8d0b5a7'),
......
...@@ -264,12 +264,12 @@ describe('UsersController', () => { ...@@ -264,12 +264,12 @@ describe('UsersController', () => {
userServiceMock.create.mockResolvedValueOnce(usersMockData[0]); userServiceMock.create.mockResolvedValueOnce(usersMockData[0]);
const result = await usersController.create(createUserDto); const result = await usersController.create(createUserDto);
expect(userCreateSpyer).toBeCalledTimes(1); expect(userCreateSpyer).toHaveBeenCalledTimes(1);
expect(structureFindOneSpyer).toBeCalledTimes(0); expect(structureFindOneSpyer).toHaveBeenCalledTimes(0);
expect(updateStructureLinkedClaimSpyer).toBeCalledTimes(0); expect(updateStructureLinkedClaimSpyer).toHaveBeenCalledTimes(0);
expect(sendAdminStructureNotificationSpyer).toBeCalledTimes(0); expect(sendAdminStructureNotificationSpyer).toHaveBeenCalledTimes(0);
expect(tempUserFindOneSpyer).toBeCalledTimes(1); expect(tempUserFindOneSpyer).toHaveBeenCalledTimes(1);
expect(tempUserDeleteSpyer).toBeCalledTimes(0); expect(tempUserDeleteSpyer).toHaveBeenCalledTimes(0);
expect(result).toEqual(usersMockData[0]); expect(result).toEqual(usersMockData[0]);
}); });
...@@ -286,12 +286,12 @@ describe('UsersController', () => { ...@@ -286,12 +286,12 @@ describe('UsersController', () => {
tempUserServiceMock.findOne.mockResolvedValueOnce({ email: 'test@test.com', pendingStructuresLink: [] }); tempUserServiceMock.findOne.mockResolvedValueOnce({ email: 'test@test.com', pendingStructuresLink: [] });
const result = await usersController.create(createUserDto); const result = await usersController.create(createUserDto);
expect(userCreateSpyer).toBeCalledTimes(1); expect(userCreateSpyer).toHaveBeenCalledTimes(1);
expect(structureFindOneSpyer).toBeCalledTimes(0); expect(structureFindOneSpyer).toHaveBeenCalledTimes(0);
expect(updateStructureLinkedClaimSpyer).toBeCalledTimes(0); expect(updateStructureLinkedClaimSpyer).toHaveBeenCalledTimes(0);
expect(sendAdminStructureNotificationSpyer).toBeCalledTimes(0); expect(sendAdminStructureNotificationSpyer).toHaveBeenCalledTimes(0);
expect(tempUserFindOneSpyer).toBeCalledTimes(1); expect(tempUserFindOneSpyer).toHaveBeenCalledTimes(1);
expect(tempUserDeleteSpyer).toBeCalledTimes(1); expect(tempUserDeleteSpyer).toHaveBeenCalledTimes(1);
expect(result).toEqual(usersMockData[0]); expect(result).toEqual(usersMockData[0]);
}); });
}); });
...@@ -300,7 +300,7 @@ describe('UsersController', () => { ...@@ -300,7 +300,7 @@ describe('UsersController', () => {
it('should call validateUser', async () => { it('should call validateUser', async () => {
const spyer = jest.spyOn(userServiceMock, 'validateUser'); const spyer = jest.spyOn(userServiceMock, 'validateUser');
await usersController.validateUser({ id: 1 }, 'token'); await usersController.validateUser({ id: 1 }, 'token');
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
}); });
...@@ -308,7 +308,7 @@ describe('UsersController', () => { ...@@ -308,7 +308,7 @@ describe('UsersController', () => {
it('should call changeUserPassword', async () => { it('should call changeUserPassword', async () => {
const spyer = jest.spyOn(userServiceMock, 'changeUserPassword'); const spyer = jest.spyOn(userServiceMock, 'changeUserPassword');
await usersController.changePassword({ user: { _id: '36', email: 'a@a.com' } }, new PasswordChangeDto()); await usersController.changePassword({ user: { _id: '36', email: 'a@a.com' } }, new PasswordChangeDto());
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
}); });
...@@ -316,7 +316,7 @@ describe('UsersController', () => { ...@@ -316,7 +316,7 @@ describe('UsersController', () => {
it('should call changeUserEmail', async () => { it('should call changeUserEmail', async () => {
const spyer = jest.spyOn(userServiceMock, 'changeUserEmail'); const spyer = jest.spyOn(userServiceMock, 'changeUserEmail');
await usersController.changeEmail(new EmailChangeDto()); await usersController.changeEmail(new EmailChangeDto());
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
}); });
...@@ -324,7 +324,7 @@ describe('UsersController', () => { ...@@ -324,7 +324,7 @@ describe('UsersController', () => {
it('should call verifyAndUpdateUserEmail', async () => { it('should call verifyAndUpdateUserEmail', async () => {
const spyer = jest.spyOn(userServiceMock, 'verifyAndUpdateUserEmail'); const spyer = jest.spyOn(userServiceMock, 'verifyAndUpdateUserEmail');
await usersController.verifyAndUpdateEmail('token'); await usersController.verifyAndUpdateEmail('token');
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
}); });
...@@ -332,7 +332,7 @@ describe('UsersController', () => { ...@@ -332,7 +332,7 @@ describe('UsersController', () => {
it('should call sendResetPasswordEmail', async () => { it('should call sendResetPasswordEmail', async () => {
const spyer = jest.spyOn(userServiceMock, 'sendResetPasswordEmail'); const spyer = jest.spyOn(userServiceMock, 'sendResetPasswordEmail');
await usersController.resetPassword(new PasswordResetDto()); await usersController.resetPassword(new PasswordResetDto());
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
}); });
...@@ -340,7 +340,7 @@ describe('UsersController', () => { ...@@ -340,7 +340,7 @@ describe('UsersController', () => {
it('should call validatePasswordResetToken', async () => { it('should call validatePasswordResetToken', async () => {
const spyer = jest.spyOn(userServiceMock, 'validatePasswordResetToken'); const spyer = jest.spyOn(userServiceMock, 'validatePasswordResetToken');
await usersController.resetPasswordApply(new PasswordResetApplyDto()); await usersController.resetPasswordApply(new PasswordResetApplyDto());
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
}); });
...@@ -348,7 +348,7 @@ describe('UsersController', () => { ...@@ -348,7 +348,7 @@ describe('UsersController', () => {
it('should call verifyUserExist', async () => { it('should call verifyUserExist', async () => {
const spyer = jest.spyOn(userServiceMock, 'verifyUserExist'); const spyer = jest.spyOn(userServiceMock, 'verifyUserExist');
await usersController.verifyUserExist({ user: { _id: '36', email: 'a@a.com' } }, { newMail: 'test@test.com' }); await usersController.verifyUserExist({ user: { _id: '36', email: 'a@a.com' } }, { newMail: 'test@test.com' });
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
}); });
...@@ -359,8 +359,8 @@ describe('UsersController', () => { ...@@ -359,8 +359,8 @@ describe('UsersController', () => {
const userWithoutStructure = usersMockData[2]; const userWithoutStructure = usersMockData[2];
userServiceMock.deleteOne.mockResolvedValueOnce(userWithoutStructure); userServiceMock.deleteOne.mockResolvedValueOnce(userWithoutStructure);
await usersController.delete({ user: { _id: '36', email: 'a@a.com' } }); await usersController.delete({ user: { _id: '36', email: 'a@a.com' } });
expect(deleteOneSpyer).toBeCalledTimes(1); expect(deleteOneSpyer).toHaveBeenCalledTimes(1);
expect(isStructureClaimedSpyer).toBeCalledTimes(0); expect(isStructureClaimedSpyer).toHaveBeenCalledTimes(0);
}); });
it('should call isStructureClaimed for each structure linked', async () => { it('should call isStructureClaimed for each structure linked', async () => {
...@@ -372,9 +372,9 @@ describe('UsersController', () => { ...@@ -372,9 +372,9 @@ describe('UsersController', () => {
userServiceMock.isStructureClaimed.mockResolvedValue(null); userServiceMock.isStructureClaimed.mockResolvedValue(null);
userServiceMock.isStructureClaimed.mockResolvedValueOnce(userWithThreeStructures); userServiceMock.isStructureClaimed.mockResolvedValueOnce(userWithThreeStructures);
await usersController.delete({ user: { _id: '36', email: 'a@a.com' } }); await usersController.delete({ user: { _id: '36', email: 'a@a.com' } });
expect(userDeleteOneSpyer).toBeCalledTimes(1); expect(userDeleteOneSpyer).toHaveBeenCalledTimes(1);
expect(isStructureClaimedSpyer).toBeCalledTimes(3); expect(isStructureClaimedSpyer).toHaveBeenCalledTimes(3);
expect(structureFindOne).toBeCalledTimes(2); expect(structureFindOne).toHaveBeenCalledTimes(2);
}); });
}); });
...@@ -382,7 +382,7 @@ describe('UsersController', () => { ...@@ -382,7 +382,7 @@ describe('UsersController', () => {
it('should call getAllDataConsentPendingStructures', async () => { it('should call getAllDataConsentPendingStructures', async () => {
const spyer = jest.spyOn(structureServiceMock, 'getAllDataConsentPendingStructures'); const spyer = jest.spyOn(structureServiceMock, 'getAllDataConsentPendingStructures');
await usersController.dataConsentValidation({ user: { _id: '36', email: 'a@a.com' } }); await usersController.dataConsentValidation({ user: { _id: '36', email: 'a@a.com' } });
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
}); });
...@@ -392,7 +392,7 @@ describe('UsersController', () => { ...@@ -392,7 +392,7 @@ describe('UsersController', () => {
userServiceMock.findById.mockResolvedValueOnce({ _id: '36', email: 'a@a.com' }); userServiceMock.findById.mockResolvedValueOnce({ _id: '36', email: 'a@a.com' });
const result = await usersController.getUser(1); const result = await usersController.getUser(1);
expect(result).toEqual({ _id: '36', email: 'a@a.com' }); expect(result).toEqual({ _id: '36', email: 'a@a.com' });
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
it('should throw error if no user found', async () => { it('should throw error if no user found', async () => {
...@@ -406,7 +406,7 @@ describe('UsersController', () => { ...@@ -406,7 +406,7 @@ describe('UsersController', () => {
expect(error.message).toBe('User does not exist'); expect(error.message).toBe('User does not exist');
expect(error.status).toBe(HttpStatus.NOT_FOUND); expect(error.status).toBe(HttpStatus.NOT_FOUND);
} }
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
}); });
...@@ -414,7 +414,7 @@ describe('UsersController', () => { ...@@ -414,7 +414,7 @@ describe('UsersController', () => {
it('should call updateDescription', async () => { it('should call updateDescription', async () => {
const spyer = jest.spyOn(userServiceMock, 'updateDescription'); const spyer = jest.spyOn(userServiceMock, 'updateDescription');
await usersController.updateDescription({ user: { _id: '36', email: 'a@a.com' } }, new DescriptionDto()); await usersController.updateDescription({ user: { _id: '36', email: 'a@a.com' } }, new DescriptionDto());
expect(spyer).toBeCalledTimes(1); expect(spyer).toHaveBeenCalledTimes(1);
}); });
}); });
}); });
...@@ -99,6 +99,6 @@ describe('isPersonalOfferOwner', () => { ...@@ -99,6 +99,6 @@ describe('isPersonalOfferOwner', () => {
const result = await guard.canActivate(context); const result = await guard.canActivate(context);
expect(result).toBeFalsy(); expect(result).toBeFalsy();
expect(reflector.get).toBeCalled(); expect(reflector.get).toHaveBeenCalled();
}); });
}); });
...@@ -99,6 +99,6 @@ describe('isStrructureOwner', () => { ...@@ -99,6 +99,6 @@ describe('isStrructureOwner', () => {
const result = await guard.canActivate(context); const result = await guard.canActivate(context);
expect(result).toBeFalsy(); expect(result).toBeFalsy();
expect(reflector.get).toBeCalled(); expect(reflector.get).toHaveBeenCalled();
}); });
}); });
...@@ -42,7 +42,7 @@ describe('RolesGuard', () => { ...@@ -42,7 +42,7 @@ describe('RolesGuard', () => {
const result = await guard.canActivate(context); const result = await guard.canActivate(context);
expect(result).toBeTruthy(); expect(result).toBeTruthy();
expect(reflector.get).toBeCalled(); expect(reflector.get).toHaveBeenCalled();
}); });
it('should return true if the `HasRoles` decorator and role is admin', async () => { it('should return true if the `HasRoles` decorator and role is admin', async () => {
...@@ -58,7 +58,7 @@ describe('RolesGuard', () => { ...@@ -58,7 +58,7 @@ describe('RolesGuard', () => {
const result = await guard.canActivate(context); const result = await guard.canActivate(context);
expect(result).toBeTruthy(); expect(result).toBeTruthy();
expect(reflector.get).toBeCalled(); expect(reflector.get).toHaveBeenCalled();
}); });
it('should return false if the `HasRoles` decorator is set but role is not allowed', async () => { it('should return false if the `HasRoles` decorator is set but role is not allowed', async () => {
...@@ -74,7 +74,7 @@ describe('RolesGuard', () => { ...@@ -74,7 +74,7 @@ describe('RolesGuard', () => {
const result = await guard.canActivate(context); const result = await guard.canActivate(context);
expect(result).toBeFalsy(); expect(result).toBeFalsy();
expect(reflector.get).toBeCalled(); expect(reflector.get).toHaveBeenCalled();
}); });
it('should return true if the `HasRoles` decorator is and role is not allowed', async () => { it('should return true if the `HasRoles` decorator is and role is not allowed', async () => {
...@@ -90,6 +90,6 @@ describe('RolesGuard', () => { ...@@ -90,6 +90,6 @@ describe('RolesGuard', () => {
const result = await guard.canActivate(context); const result = await guard.canActivate(context);
expect(result).toBeTruthy(); expect(result).toBeTruthy();
expect(reflector.get).toBeCalled(); expect(reflector.get).toHaveBeenCalled();
}); });
}); });
...@@ -184,7 +184,7 @@ describe('EmployerService', () => { ...@@ -184,7 +184,7 @@ describe('EmployerService', () => {
jest.spyOn(employerService, 'sendAdminCreateNotification').mockResolvedValueOnce(); jest.spyOn(employerService, 'sendAdminCreateNotification').mockResolvedValueOnce();
const reply = await employerService.create(createEmployer); const reply = await employerService.create(createEmployer);
expect(reply).toBeTruthy(); expect(reply).toBeTruthy();
expect(employerService.sendAdminCreateNotification).toBeCalledTimes(1); expect(employerService.sendAdminCreateNotification).toHaveBeenCalledTimes(1);
}); });
it('should create validated employer and not send email to admins', async () => { it('should create validated employer and not send email to admins', async () => {
...@@ -406,7 +406,7 @@ describe('EmployerService', () => { ...@@ -406,7 +406,7 @@ describe('EmployerService', () => {
}); });
describe('deleteOneId', () => { describe('deleteOneId', () => {
it('should delete ', async () => { it('should delete', async () => {
mockEmployerModel.findOne.mockReturnThis(); mockEmployerModel.findOne.mockReturnThis();
mockEmployerModel.exec.mockResolvedValueOnce({ mockEmployerModel.exec.mockResolvedValueOnce({
_id: '6231aefe76598527c8d0b5bc', _id: '6231aefe76598527c8d0b5bc',
...@@ -445,7 +445,7 @@ describe('EmployerService', () => { ...@@ -445,7 +445,7 @@ describe('EmployerService', () => {
personalOffers: [], personalOffers: [],
}); });
}); });
it('should throw an error ', async () => { it('should throw an error', async () => {
mockEmployerModel.findOne.mockReturnThis(); mockEmployerModel.findOne.mockReturnThis();
mockEmployerModel.exec.mockResolvedValueOnce(null); mockEmployerModel.exec.mockResolvedValueOnce(null);
......
...@@ -219,7 +219,7 @@ describe('JobsService', () => { ...@@ -219,7 +219,7 @@ describe('JobsService', () => {
}; };
mockUserService.getAdmins.mockResolvedValueOnce(mockSingleAdminResponse); mockUserService.getAdmins.mockResolvedValueOnce(mockSingleAdminResponse);
await jobsService.sendAdminCreateNotification(job as JobDocument, 'adminJobCreate.ejs', 'adminJobCreate.json'); await jobsService.sendAdminCreateNotification(job as JobDocument, 'adminJobCreate.ejs', 'adminJobCreate.json');
expect(mockMailService.send).toBeCalledTimes(1); expect(mockMailService.send).toHaveBeenCalledTimes(1);
}); });
}); });
...@@ -325,7 +325,7 @@ describe('JobsService', () => { ...@@ -325,7 +325,7 @@ describe('JobsService', () => {
}); });
describe('deleteOneId', () => { describe('deleteOneId', () => {
it('should delete ', async () => { it('should delete', async () => {
mockJobModel.exec.mockResolvedValueOnce({ mockJobModel.exec.mockResolvedValueOnce({
_id: new Types.ObjectId('623aed68c5d45b6fbbaa7e60'), _id: new Types.ObjectId('623aed68c5d45b6fbbaa7e60'),
name: 'Dev', name: 'Dev',
...@@ -335,7 +335,7 @@ describe('JobsService', () => { ...@@ -335,7 +335,7 @@ describe('JobsService', () => {
const reply = await jobsService.deleteOneId('623aed68c5d45b6fbbaa7e60'); const reply = await jobsService.deleteOneId('623aed68c5d45b6fbbaa7e60');
expect(reply).toBe('toto'); expect(reply).toBe('toto');
}); });
it('should delete ', async () => { it('should delete', async () => {
mockJobModel.exec.mockResolvedValueOnce(null); mockJobModel.exec.mockResolvedValueOnce(null);
try { try {
await jobsService.deleteOneId('623aed68c5d45b6fbbaa7e60'); await jobsService.deleteOneId('623aed68c5d45b6fbbaa7e60');
......
...@@ -61,7 +61,7 @@ describe('UserRegistrySearchService Search cases', () => { ...@@ -61,7 +61,7 @@ describe('UserRegistrySearchService Search cases', () => {
jest.spyOn(ElasticsearchService.prototype, 'delete').mockImplementation(mockDelete); jest.spyOn(ElasticsearchService.prototype, 'delete').mockImplementation(mockDelete);
const resAdm = await userRegistrySearchService.search('adm'); const resAdm = await userRegistrySearchService.search('adm');
await userRegistrySearchService.deleteIndex(resAdm[0] as IUserRegistry); await userRegistrySearchService.deleteIndex(resAdm[0] as IUserRegistry);
expect(mockDelete).toBeCalled(); expect(mockDelete).toHaveBeenCalled();
}); });
}); });
}); });