Skip to content

Commit

Permalink
update tests to match current expected values
Browse files Browse the repository at this point in the history
  • Loading branch information
hotzevzl committed Dec 6, 2024
1 parent 8f9f460 commit 8fbcda2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ describe(ComputeArea, () => {
const getFixtures = async () => {
const computeMarxanAmountPerPlanningUnitMock = jest.fn();
const findProjectMock = jest.fn();
const findGeoFeatureMock = jest.fn();
const findOneOrFailGeoFeatureMock = jest.fn();
const findOneGeoFeatureMock = jest.fn();
const saveAmountRangeForFeaturesMock = jest.fn();
const sandbox = await Test.createTestingModule({
imports: [],
Expand All @@ -96,7 +97,10 @@ const getFixtures = async () => {
},
{
provide: getRepositoryToken(GeoFeature),
useValue: { findOneOrFail: findGeoFeatureMock },
useValue: {
findOneOrFail: findOneOrFailGeoFeatureMock,
findOne: findOneGeoFeatureMock,
},
},
{
provide: GeoFeaturesService,
Expand Down Expand Up @@ -189,11 +193,14 @@ const getFixtures = async () => {
];
},
GivenMinMaxAmount: (featureId: string, min?: number, max?: number) => {
findGeoFeatureMock.mockResolvedValueOnce({
findOneOrFailGeoFeatureMock.mockResolvedValueOnce({
id: featureId,
amountMin: min,
amountMax: max,
});
findOneGeoFeatureMock.mockResolvedValueOnce({
featureDataStableIds: [],
});
},
WhenComputing: (projectId: string, scenarioId: string, featureId: string) =>
sut.computeAreaPerPlanningUnitOfFeature(projectId, scenarioId, featureId),
Expand Down
38 changes: 19 additions & 19 deletions api/apps/api/test/upload-feature/upload-feature.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,25 +389,25 @@ export const getFixtures = async () => {
featureClassName: name,
},
});
expect(features).toEqual([
{
id: expect.any(String),
featureClassName: name,
featureDataStableIds: null,
description,
alias: null,
amountMax: 5296399725.20094,
amountMin: 820348505.9774874,
propertyName: null,
intersection: null,
creationStatus: JobStatus.created,
projectId,
isCustom: true,
isLegacy: false,
fromGeoprocessingOps: null,
geoprocessingOpsHash: null,
},
]);
const expectedFeature = new GeoFeature();
Object.assign(expectedFeature, {
id: expect.any(String),
featureClassName: name,
featureDataStableIds: [expect.any(String)],
description,
alias: null,
amountMax: 5296399725.20094,
amountMin: 820348505.9774874,
propertyName: null,
intersection: null,
creationStatus: JobStatus.created,
projectId,
isCustom: true,
isLegacy: false,
fromGeoprocessingOps: null,
geoprocessingOpsHash: null,
});
expect(features).toEqual([expectedFeature]);
expect(
await geoFeatureDataRepo.find({
where: {
Expand Down

0 comments on commit 8fbcda2

Please sign in to comment.