mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
Merge pull request #319 from Hestia-Homes/main
Some checks are pending
Test Suite / unit-tests (push) Waiting to run
Some checks are pending
Test Suite / unit-tests (push) Waiting to run
Don't include PAR photopack in MIssing Documents list
This commit is contained in:
commit
73a0b23f06
2 changed files with 8 additions and 9 deletions
|
|
@ -5,6 +5,7 @@ import {
|
|||
getUnassignedInstallDocs,
|
||||
} from "./propertyDocuments";
|
||||
import type { PropertyDocument, MeasureDocProgress } from "./types";
|
||||
import { EXPECTED_RETROFIT_ASSESSMENT_DOC_TYPES } from "./types";
|
||||
|
||||
function makeDoc(overrides: Partial<PropertyDocument> = {}): PropertyDocument {
|
||||
return {
|
||||
|
|
@ -75,22 +76,20 @@ describe("splitDocumentsByType", () => {
|
|||
describe("getMissingRetrofitTypes", () => {
|
||||
it("returns all mandatory types when no docs uploaded", () => {
|
||||
const missing = getMissingSurveyDocTypes([]);
|
||||
expect(missing).toHaveLength(8);
|
||||
expect(missing).toHaveLength(EXPECTED_RETROFIT_ASSESSMENT_DOC_TYPES.length);
|
||||
});
|
||||
|
||||
it("excludes types that have been uploaded", () => {
|
||||
const uploaded = [makeDoc({ docType: "photo_pack" })];
|
||||
const missing = getMissingSurveyDocTypes(uploaded);
|
||||
expect(missing).not.toContain("photo_pack");
|
||||
expect(missing).toHaveLength(7);
|
||||
expect(missing).toHaveLength(EXPECTED_RETROFIT_ASSESSMENT_DOC_TYPES.length - 1);
|
||||
});
|
||||
|
||||
it("returns empty array when all mandatory types uploaded", () => {
|
||||
const uploaded = [
|
||||
"photo_pack", "site_note", "rd_sap_site_note", "pas_2023_ventilation",
|
||||
"pas_2023_condition", "pas_significance", "par_photo_pack",
|
||||
"pas_2023_property", "pas_2023_occupancy",
|
||||
].map((docType, i) => makeDoc({ id: String(i), docType }));
|
||||
const uploaded = EXPECTED_RETROFIT_ASSESSMENT_DOC_TYPES.map((docType, i) =>
|
||||
makeDoc({ id: String(i), docType })
|
||||
);
|
||||
expect(getMissingSurveyDocTypes(uploaded)).toHaveLength(0);
|
||||
});
|
||||
|
||||
|
|
@ -98,7 +97,7 @@ describe("getMissingRetrofitTypes", () => {
|
|||
const uploaded = [makeDoc({ docType: "ecmk_site_note" })];
|
||||
const missing = getMissingSurveyDocTypes(uploaded);
|
||||
expect(missing).not.toContain("ecmk_site_note");
|
||||
expect(missing).toHaveLength(8);
|
||||
expect(missing).toHaveLength(EXPECTED_RETROFIT_ASSESSMENT_DOC_TYPES.length);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,6 @@ export const EXPECTED_RETROFIT_ASSESSMENT_DOC_TYPES = [
|
|||
"rd_sap_site_note",
|
||||
"pas_2023_ventilation",
|
||||
"pas_2023_condition",
|
||||
"par_photo_pack",
|
||||
"pas_2023_property",
|
||||
"pas_2023_occupancy",
|
||||
] as const;
|
||||
|
|
@ -250,6 +249,7 @@ export const SURVEY_ALL_DOC_TYPES = new Set<string>([
|
|||
"ecmk_rd_sap_site_note",
|
||||
"ecmk_survey_xml",
|
||||
"pas_significance",
|
||||
"par_photo_pack",
|
||||
]);
|
||||
|
||||
// Coordination doc types
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue