task p-4.5
This commit is contained in:
@@ -135,6 +135,9 @@ async function main() {
|
||||
const priceTable = payload.templateInput.quotation_price_data;
|
||||
const priceTableRows = Array.isArray(priceTable) ? priceTable : [];
|
||||
const firstPriceRow = Array.isArray(priceTableRows[0]) ? (priceTableRows[0] as unknown[]) : [];
|
||||
const itemsTable = payload.templateInput.items_table;
|
||||
const itemsTableRows = Array.isArray(itemsTable) ? itemsTable : [];
|
||||
const firstItemsRow = Array.isArray(itemsTableRows[0]) ? (itemsTableRows[0] as unknown[]) : [];
|
||||
|
||||
pushFinding(findings, {
|
||||
field: 'templateInput.quotation_price_data',
|
||||
@@ -172,6 +175,24 @@ async function main() {
|
||||
value: firstPriceRow[3] ?? null,
|
||||
message: 'Price table currency code cell is populated'
|
||||
});
|
||||
if (itemsTable !== undefined) {
|
||||
pushFinding(findings, {
|
||||
field: 'templateInput.items_table',
|
||||
source: 'templateInput',
|
||||
status: Array.isArray(itemsTable) ? 'PASS' : 'FAIL',
|
||||
value: Array.isArray(itemsTable) ? `rows:${itemsTable.length}` : itemsTable,
|
||||
message: Array.isArray(itemsTable)
|
||||
? 'Product items table input is present'
|
||||
: 'Product items table input is missing or not table'
|
||||
});
|
||||
pushFinding(findings, {
|
||||
field: 'templateInput.items_table[0]',
|
||||
source: 'templateInput',
|
||||
status: firstItemsRow.length === 7 ? 'PASS' : 'FAIL',
|
||||
value: firstItemsRow.length,
|
||||
message: 'Product items table row shape uses seven columns'
|
||||
});
|
||||
}
|
||||
|
||||
const staticLabelFindings = [...PDFME_STATIC_LABEL_FIELD_KEYS].map((fieldName) => {
|
||||
const value = payload.templateInput[fieldName];
|
||||
|
||||
Reference in New Issue
Block a user