Skip to content

Commit

Permalink
fix building service test
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarkowsky committed Jul 9, 2024
1 parent f8d83ca commit a8baeec
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions express-api/tests/unit/services/buildings/buildingService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,22 @@ const _buildingSave = jest
.spyOn(buildingRepo, 'save')
.mockImplementation(async (building: DeepPartial<Building> & Building) => building);

const _buildingFindOne = jest.spyOn(buildingRepo, 'findOne').mockImplementation(async () => {
const building = produceBuilding();
const { Id } = building;
produceBuildingFiscal(Id);
return building;
});

// const _buildingFiscalExists = jest
// .spyOn(AppDataSource.getRepository(BuildingFiscal), 'exists')
// .mockImplementation(async () => true);

// const _buildingEvaluationExists = jest
// .spyOn(AppDataSource.getRepository(BuildingEvaluation), 'exists')
// .mockImplementation(async () => true);
const _buildingFiscalFindOne = jest
.spyOn(AppDataSource.getRepository(BuildingFiscal), 'findOne')
.mockImplementation(async () => produceBuildingFiscal(1)[0]);

const _buildingEvaluationFindOne = jest
.spyOn(AppDataSource.getRepository(BuildingEvaluation), 'findOne')
.mockImplementation(async () => produceBuildingEvaluation(1)[0]);
// const _buildingFindOne = jest
// .spyOn(buildingRepo, 'findOne')
// .mockImplementation(async () => produceBuilding());

const _buildingFindOne = jest
.spyOn(buildingRepo, 'findOne')
.mockImplementation(async () => produceBuilding());

jest
.spyOn(AppDataSource.getRepository(BuildingFiscal), 'find')
.mockImplementation(async () => produceBuildingFiscal(1));

jest
.spyOn(AppDataSource.getRepository(BuildingEvaluation), 'find')
.mockImplementation(async () => produceBuildingEvaluation(1));
Expand Down

0 comments on commit a8baeec

Please sign in to comment.