Verify Revit reference CSV
This commit is contained in:
@@ -103,6 +103,25 @@ describe("external CSV configuration", () => {
|
||||
});
|
||||
assert.match(validateFailure(invalidQuantity), /positive finite number/);
|
||||
});
|
||||
|
||||
it("allows a missing quantity column only for fixed quantity rules", () => {
|
||||
const configuration = createDefaultExternalCsvConfiguration({
|
||||
...columns,
|
||||
quantity: null,
|
||||
});
|
||||
configuration.familyTypeRules.push({
|
||||
exactFamilyAndType: "Steckdose: Standard",
|
||||
internalDeviceType: "Steckdose",
|
||||
connectionKind: null,
|
||||
category: "single_phase",
|
||||
quantityRule: { kind: "fixed", quantity: 1 },
|
||||
displayNameSuggestion: null,
|
||||
});
|
||||
assert.equal(validateExternalCsvConfiguration(configuration).success, true);
|
||||
|
||||
configuration.familyTypeRules[0].quantityRule = { kind: "mapped-column" };
|
||||
assert.match(validateFailure(configuration), /requires a configured quantity column/);
|
||||
});
|
||||
});
|
||||
|
||||
function validateFailure(value: unknown) {
|
||||
|
||||
@@ -51,6 +51,28 @@ describe("external CSV transport", () => {
|
||||
assert.deepEqual(serializeExternalCsv(document), source);
|
||||
});
|
||||
|
||||
it("parses exports without an optional quantity column", () => {
|
||||
const configuration = {
|
||||
...externalCsvTestConfiguration,
|
||||
columns: {
|
||||
...externalCsvTestConfiguration.columns,
|
||||
quantity: null,
|
||||
},
|
||||
};
|
||||
const csv = [
|
||||
'"Projekt-Export";"";"";"";"";"";""',
|
||||
'"Stromkreis";"Raumnummer";"Raumname";"Familie und Typ";"CAx_Auswahlkenner";"Elektrische Leistung";"IfcGUID"',
|
||||
`"UV_AV_01-2F1";"01/101";"Technik";"Steckdose: Standard";"Arbeitsplatz";"100";"${firstIfcGuid}"`,
|
||||
].join("\r\n") + "\r\n";
|
||||
|
||||
const document = parseExternalCsv(utf8Bytes(csv, true), configuration);
|
||||
|
||||
assert.equal(
|
||||
document.rows.filter((row) => row.classification === "object").length,
|
||||
1
|
||||
);
|
||||
});
|
||||
|
||||
it("preserves embedded delimiters and line endings inside quoted cells", () => {
|
||||
const csv = quotedRevitCsv.replace(
|
||||
'"Steckdose: Doppelsteckdose"',
|
||||
|
||||
Reference in New Issue
Block a user