diff --git a/api/test/e2e/h3-data/h3-data.spec.ts b/api/test/e2e/h3-data/h3-data.spec.ts index 53c27a31b7..c03127083a 100644 --- a/api/test/e2e/h3-data/h3-data.spec.ts +++ b/api/test/e2e/h3-data/h3-data.spec.ts @@ -17,7 +17,10 @@ import { createSourcingRecord, } from '../../entity-mocks'; import { H3Data } from 'modules/h3-data/h3-data.entity'; -import { Indicator } from 'modules/indicators/indicator.entity'; +import { + Indicator, + INDICATOR_NAME_CODES, +} from 'modules/indicators/indicator.entity'; import { MATERIAL_TO_H3_TYPE } from 'modules/materials/material-to-h3.entity'; import { MaterialsToH3sService } from 'modules/materials/materials-to-h3s.service'; import { h3BasicFixture } from './mocks/h3-fixtures'; @@ -320,7 +323,7 @@ describe('H3-Data Module (e2e) - Get H3 data', () => { test('Given there is material H3 data, When I query available years providing a indicator id, then I should get all available years for that indicator', async () => { const years = [2001, 2001, 2002, 2003, 2007]; const savedIndicator: Indicator = await createIndicator({ - nameCode: 'GAMMA_RADIATION', + nameCode: 'GAMMA_RADIATION' as INDICATOR_NAME_CODES, }); const fakeH3MasterData: Array> = []; for await (const year of years) { diff --git a/api/test/e2e/h3-data/mocks/h3-data.mock.ts b/api/test/e2e/h3-data/mocks/h3-data.mock.ts index 5e207c30f7..6c6bf850d1 100644 --- a/api/test/e2e/h3-data/mocks/h3-data.mock.ts +++ b/api/test/e2e/h3-data/mocks/h3-data.mock.ts @@ -1,6 +1,7 @@ import { DataSource } from 'typeorm'; import { H3Data } from 'modules/h3-data/h3-data.entity'; import { snakeCase, camelCase } from 'typeorm/util/StringUtils'; +import { INDICATOR_NAME_CODES } from '../../../../src/modules/indicators/indicator.entity'; export const h3DataMock = async ( dataSource: DataSource, @@ -58,5 +59,5 @@ export const dropH3DataMock = async ( export const createRandomNamesForH3TableAndColumns = (): string => (Math.random() + 1).toString(36).substring(2); -export const createRandomIndicatorNameCode = (): string => - `${Math.random() + 1}_${Math.random() + 1}`; +export const createRandomIndicatorNameCode = (): INDICATOR_NAME_CODES => + `${Math.random() + 1}_${Math.random() + 1}` as INDICATOR_NAME_CODES; diff --git a/api/test/e2e/h3-data/mocks/h3-impact-map.mock.ts b/api/test/e2e/h3-data/mocks/h3-impact-map.mock.ts index ef23d30d19..9130a16f4f 100644 --- a/api/test/e2e/h3-data/mocks/h3-impact-map.mock.ts +++ b/api/test/e2e/h3-data/mocks/h3-impact-map.mock.ts @@ -2,6 +2,7 @@ import { Unit } from 'modules/units/unit.entity'; import { UnitConversion } from 'modules/unit-conversions/unit-conversion.entity'; import { Indicator, + INDICATOR_NAME_CODES, INDICATOR_STATUS, } from 'modules/indicators/indicator.entity'; import { h3DataMock } from './h3-data.mock'; @@ -81,14 +82,14 @@ export const createImpactMapMockData = async ( const indicator: Indicator = new Indicator(); indicator.name = 'test indicator'; indicator.unit = unit; - indicator.nameCode = 'UWU_T'; + indicator.nameCode = 'UWU_T' as INDICATOR_NAME_CODES; await indicator.save(); const inactiveIndicator: Indicator = new Indicator(); inactiveIndicator.name = 'Inactive Indicator'; inactiveIndicator.unit = unit; inactiveIndicator.status = INDICATOR_STATUS.INACTIVE; - inactiveIndicator.nameCode = 'INA_IN'; + inactiveIndicator.nameCode = 'INA_IN' as INDICATOR_NAME_CODES; await inactiveIndicator.save(); const harvestH3Data = await h3DataMock(dataSource, { diff --git a/api/test/e2e/impact/mocks/actual-vs-scenario-preconditions/two-scenarios.preconditions.ts b/api/test/e2e/impact/mocks/actual-vs-scenario-preconditions/two-scenarios.preconditions.ts index 7bdb67810d..0daf6c39cc 100644 --- a/api/test/e2e/impact/mocks/actual-vs-scenario-preconditions/two-scenarios.preconditions.ts +++ b/api/test/e2e/impact/mocks/actual-vs-scenario-preconditions/two-scenarios.preconditions.ts @@ -30,7 +30,7 @@ export async function createTwoScenariosPreconditions(): Promise<{ name: 'Deforestation', shortName: 'Deforestation', unit, - nameCode: INDICATOR_NAME_CODES.DEFORESTATION, + nameCode: INDICATOR_NAME_CODES.DEFORESTATION_RISK, }); const textile: Material = await createMaterial({ name: 'Textile' }); diff --git a/api/test/e2e/impact/mocks/scenario-vs-scenario-preconditions/mixed-scenarios.preconditions.ts b/api/test/e2e/impact/mocks/scenario-vs-scenario-preconditions/mixed-scenarios.preconditions.ts index 27600afd4f..5c44ae4d37 100644 --- a/api/test/e2e/impact/mocks/scenario-vs-scenario-preconditions/mixed-scenarios.preconditions.ts +++ b/api/test/e2e/impact/mocks/scenario-vs-scenario-preconditions/mixed-scenarios.preconditions.ts @@ -41,7 +41,7 @@ export async function createMixedScenariosPreconditions(): Promise<{ const indicator: Indicator = await createIndicator({ name: 'Deforestation', unit, - nameCode: INDICATOR_NAME_CODES.DEFORESTATION, + nameCode: INDICATOR_NAME_CODES.DEFORESTATION_RISK, }); const textile: Material = await createMaterial({ name: 'Textile' }); diff --git a/api/test/e2e/targets/targets.spec.ts b/api/test/e2e/targets/targets.spec.ts index 203778a0ed..0930212fd6 100644 --- a/api/test/e2e/targets/targets.spec.ts +++ b/api/test/e2e/targets/targets.spec.ts @@ -3,7 +3,10 @@ import * as request from 'supertest'; import { Target } from 'modules/targets/target.entity'; import { TargetsRepository } from 'modules/targets/targets.repository'; import { createIndicator, createTarget } from '../../entity-mocks'; -import { Indicator } from 'modules/indicators/indicator.entity'; +import { + Indicator, + INDICATOR_NAME_CODES, +} from 'modules/indicators/indicator.entity'; import { IndicatorRepository } from 'modules/indicators/indicator.repository'; import { clearTestDataFromDatabase } from '../../utils/database-test-helper'; import { DataSource } from 'typeorm'; @@ -51,7 +54,7 @@ describe('Tasks Module (e2e)', () => { describe('Targets - Create', () => { test('Creating a new target (happy case)', async () => { const indicator: Indicator = await createIndicator({ - nameCode: 'GAMMA_RADIATION', + nameCode: 'GAMMA_RADIATION' as INDICATOR_NAME_CODES, }); const response = await request(testApplication.getHttpServer())