-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [#188645598] add environmental questionnaire for land
- Loading branch information
Showing
34 changed files
with
2,343 additions
and
764 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
api/src/db/migrations/v152_add_land_to_environment_data.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { | ||
generatev151Business, | ||
generatev151UserData, | ||
generatev151WasteData, | ||
generatev151WasteQuestionnaireData, | ||
} from "@db/migrations/v151_extract_business_data"; | ||
import { migrate_v151_to_v152, v152EnvironmentData } from "@db/migrations/v152_add_land_to_environment_data"; | ||
|
||
describe("v152_add_land_to_environment_data", () => { | ||
it("migrates environment data when waste task is COMPLETED", () => { | ||
const id = "biz-1"; | ||
const v151Business = generatev151Business({ | ||
taskProgress: { "waste-permitting": "COMPLETED" }, | ||
environmentData: { | ||
waste: generatev151WasteData({ | ||
questionnaireData: generatev151WasteQuestionnaireData({ | ||
hazardousMedicalWaste: false, | ||
constructionDebris: true, | ||
compostWaste: true, | ||
treatProcessWaste: false, | ||
noWaste: false, | ||
}), | ||
submitted: true, | ||
}), | ||
}, | ||
id, | ||
}); | ||
const v151User = generatev151UserData({ | ||
businesses: { "biz-1": v151Business }, | ||
}); | ||
|
||
const v152User = migrate_v151_to_v152(v151User); | ||
|
||
expect(v152User.businesses[id].environmentData?.waste?.questionnaireData).toEqual({ | ||
hazardousMedicalWaste: false, | ||
constructionDebris: true, | ||
compostWaste: true, | ||
treatProcessWaste: false, | ||
noWaste: false, | ||
}); | ||
expect(v152User.businesses[id].environmentData?.waste?.submitted).toEqual(true); | ||
expect(v152User.businesses[id].taskProgress["waste-permitting"]).toEqual("COMPLETED"); | ||
}); | ||
|
||
it("migrates environment data when waste task is IN_PROGRESS", () => { | ||
const id = "biz-1"; | ||
const v151Business = generatev151Business({ | ||
taskProgress: { "waste-permitting": "IN_PROGRESS" }, | ||
environmentData: { | ||
waste: generatev151WasteData({ | ||
questionnaireData: generatev151WasteQuestionnaireData({ | ||
hazardousMedicalWaste: false, | ||
constructionDebris: true, | ||
compostWaste: true, | ||
treatProcessWaste: false, | ||
noWaste: false, | ||
}), | ||
submitted: false, | ||
}), | ||
}, | ||
id, | ||
}); | ||
const v151User = generatev151UserData({ | ||
businesses: { "biz-1": v151Business }, | ||
}); | ||
|
||
const v152User = migrate_v151_to_v152(v151User); | ||
|
||
expect(v152User.businesses[id].environmentData?.waste?.questionnaireData).toEqual({ | ||
hazardousMedicalWaste: false, | ||
constructionDebris: true, | ||
compostWaste: true, | ||
treatProcessWaste: false, | ||
noWaste: false, | ||
}); | ||
expect(v152User.businesses[id].environmentData?.waste?.submitted).toEqual(false); | ||
expect(v152User.businesses[id].taskProgress["waste-permitting"]).toEqual("IN_PROGRESS"); | ||
}); | ||
|
||
it("adds land section to environment data", () => { | ||
const id = "biz-1"; | ||
const v151Business = generatev151Business({ | ||
taskProgress: { "waste-permitting": "IN_PROGRESS" }, | ||
environmentData: { | ||
waste: generatev151WasteData({}), | ||
}, | ||
id, | ||
}); | ||
const v151User = generatev151UserData({ | ||
businesses: { "biz-1": v151Business }, | ||
}); | ||
const v152User = migrate_v151_to_v152(v151User); | ||
const environmentData = v152User.businesses[id].environmentData as v152EnvironmentData; | ||
expect("land" in environmentData).toEqual(true); | ||
}); | ||
}); |
Oops, something went wrong.