pict-section-form 1.3.16 → 1.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,27 +0,0 @@
1
- /*
2
- R0: the unmodified RNI 1409 manifest under the Headlight host, opened on the same saved document, so the
3
- error log lines R1 shows can be told apart from ones the distilling introduced. Local-only.
4
- */
5
-
6
- const libFS = require('fs');
7
- const libPath = require('path');
8
- const libOS = require('os');
9
-
10
- const RNI_PATH = libPath.join(libOS.homedir(), 'walbec_product_extract/RNI_1409.json');
11
-
12
- module.exports =
13
- {
14
- Host: 'Headlight',
15
- Baseline: true,
16
- Title: 'The unmodified RNI 1409 manifest under the Headlight host (error-log baseline)',
17
- page: () => ({ SelectColumns: [], ProbeAddresses: [], Manifest: JSON.parse(libFS.readFileSync(RNI_PATH, 'utf8')).Options.FormDefinition.DefaultFormManifest }),
18
- scenarios: () =>
19
- {
20
- const tmpSaved = JSON.parse(libFS.readFileSync(process.env.SANDBOX_SAVED_DOCUMENT, 'utf8'));
21
- return (
22
- [
23
- { Name: 'blank', Script: [], checks: () => [] },
24
- { Name: `saved-document-${tmpSaved.IDDocument}`, AppData: { DocumentData: { ReportData: { IDDocument: tmpSaved.IDDocument, IDProject: tmpSaved.IDProject, FormData: tmpSaved.FormData } } }, Script: [], checks: () => [] },
25
- ]);
26
- },
27
- };
@@ -1,136 +0,0 @@
1
- /*
2
- R1: the generated RNI 1409 manifest itself (tools/integration/walbec_aggregate_products/dist), rendered by
3
- the Headlight host, against the real products and a real saved document. Local-only.
4
- */
5
-
6
- const libFS = require('fs');
7
- const libPath = require('path');
8
- const libOS = require('os');
9
- const libCommon = require('./_Common.js');
10
-
11
- const RNI_PATH = libPath.join(libOS.homedir(), 'dev/headlight/tools/integration/walbec_aggregate_products/dist/RNI_1409-AggregateDistilling.json');
12
- const SAVED_DOCUMENT_PATH = process.env.SANDBOX_SAVED_DOCUMENT;
13
- const BLEND_ADDRESS = `${libCommon.MARSHAL_ROOT}.FormulaData.AggregateBlend`;
14
- const SELECT_COLUMNS = [ 'Site', 'PitNumber', 'Material' ];
15
-
16
- const fManifest = () => JSON.parse(libFS.readFileSync(RNI_PATH, 'utf8')).Options.FormDefinition.DefaultFormManifest;
17
-
18
- function page()
19
- {
20
- return { SelectColumns: SELECT_COLUMNS, ProbeAddresses: [ BLEND_ADDRESS ], Manifest: fManifest() };
21
- }
22
-
23
- function scenarios(pFixtures)
24
- {
25
- const tmpProduct = pFixtures.UniquePitProduct;
26
- const tmpOther = pFixtures.ProductElsewhere;
27
- const fRowIs = (pRow, pProduct) => (String(pRow.Material) === String(pProduct.IDProduct)) && (pRow.Site === pProduct.Site) && (String(pRow.PitNumber) === String(pProduct.PitNumber))
28
- && (String(pRow.Producer) === String(pProduct.IDOrganization)) && (String(pRow.DesignYear) === String(pProduct.DesignYear)) && (pRow.MaterialName === pProduct.Name);
29
- const fBlendHas = (pSnapshot, pProduct) => (pSnapshot.Probe[BLEND_ADDRESS] || []).some((pEntry) => (String(pEntry.Name) === String(pProduct.IDProduct)) && (String(pEntry.Source) === String(pProduct.IDOrganization))
30
- && (pEntry.Site === pProduct.Site) && (String(pEntry.PitNumber) === String(pProduct.PitNumber)) && (String(pEntry.DesignYear) === String(pProduct.DesignYear)));
31
- const fIntegrity = (pResults, pGraph) => libCommon.integrityChecks(pResults, pGraph, SELECT_COLUMNS);
32
- const tmpScenarios =
33
- [
34
- {
35
- Name: 'real-site-then-pit',
36
- Script:
37
- [
38
- { Action: 'choose', Row: 0, Column: 'Site', Value: pFixtures.MultiPitSite },
39
- { Action: 'snapshot', Label: 'site' },
40
- { Action: 'choose', Row: 0, Column: 'PitNumber', Value: pFixtures.UniquePit },
41
- { Action: 'snapshot', Label: 'pit' },
42
- ],
43
- checks: (pResults, pFixtures2, pGraph) =>
44
- {
45
- const tmpSite = libCommon.snapshot(pResults, 'site');
46
- const tmpPit = libCommon.snapshot(pResults, 'pit');
47
- return (
48
- [
49
- libCommon.check('Pit list narrows to the pits at the Site', libCommon.sameSet(tmpSite.Rows[0].Options.PitNumber, pFixtures.PitsOfMultiPitSite), tmpSite.Rows[0].Options.PitNumber),
50
- libCommon.check('a single-product Pit fills the product and carries Producer, DesignYear and name', fRowIs(tmpPit.Rows[0].Data, tmpProduct), tmpPit.Rows[0].Data),
51
- libCommon.check('FormulaData.AggregateBlend carries Name/Source as before, plus Site and PitNumber, in the same solve', fBlendHas(tmpPit, tmpProduct), tmpPit.Probe[BLEND_ADDRESS]),
52
- ].concat(fIntegrity(pResults, pGraph)));
53
- }
54
- },
55
- {
56
- Name: 'real-product-first',
57
- Script:
58
- [
59
- { Action: 'choose', Row: 1, Column: 'Material', Value: String(tmpOther.IDProduct) },
60
- { Action: 'snapshot', Label: 'chosen' },
61
- ],
62
- checks: (pResults, pFixtures2, pGraph) =>
63
- {
64
- const tmpChosen = libCommon.snapshot(pResults, 'chosen');
65
- return (
66
- [
67
- libCommon.check('choosing the product fills Site and Pit and carries its values', fRowIs(tmpChosen.Rows[1].Data, tmpOther), tmpChosen.Rows[1].Data),
68
- libCommon.check('...and lands in the blend', fBlendHas(tmpChosen, tmpOther), tmpChosen.Probe[BLEND_ADDRESS]),
69
- ].concat(fIntegrity(pResults, pGraph)));
70
- }
71
- },
72
- {
73
- Name: 'real-change-site-clears-product',
74
- Script:
75
- [
76
- { Action: 'choose', Row: 0, Column: 'Material', Value: String(tmpProduct.IDProduct) },
77
- { Action: 'choose', Row: 0, Column: 'Site', Value: pFixtures.OtherSite },
78
- { Action: 'snapshot', Label: 'changed' },
79
- ],
80
- checks: (pResults, pFixtures2, pGraph) =>
81
- {
82
- const tmpRow = libCommon.snapshot(pResults, 'changed').Rows[0].Data;
83
- return (
84
- [
85
- libCommon.check('the new Site is kept and the product (and its carried values) that is not there is cleared or replaced consistently',
86
- (tmpRow.Site === pFixtures.OtherSite) && ((!tmpRow.Material && !tmpRow.Producer && !tmpRow.MaterialName) || (libCommon.matching(pGraph, { Site: tmpRow.Site, IDProduct: tmpRow.Material }).length > 0)), tmpRow),
87
- ].concat(fIntegrity(pResults, pGraph)));
88
- }
89
- },
90
- ];
91
- if (SAVED_DOCUMENT_PATH)
92
- {
93
- const tmpSaved = JSON.parse(libFS.readFileSync(SAVED_DOCUMENT_PATH, 'utf8'));
94
- const tmpSavedRows = JSON.parse(JSON.stringify(tmpSaved.FormData[libCommon.ROWS_ADDRESS]));
95
- tmpScenarios.push(
96
- {
97
- Name: `real-saved-document-${tmpSaved.IDDocument}`,
98
- AppData: { DocumentData: { ReportData: { IDDocument: tmpSaved.IDDocument, IDProject: tmpSaved.IDProject, FormData: tmpSaved.FormData } } },
99
- Script:
100
- [
101
- { Action: 'snapshot', Label: 'opened' },
102
- { Action: 'choose', Row: 3, Column: 'Material', Value: String(tmpOther.IDProduct) },
103
- { Action: 'snapshot', Label: 'edited' },
104
- ],
105
- checks: (pResults, pFixtures2, pGraph) =>
106
- {
107
- const tmpOpened = libCommon.snapshot(pResults, 'opened');
108
- const tmpEdited = libCommon.snapshot(pResults, 'edited');
109
- const tmpKept = [ 'Material', 'Producer', 'DesignYear', 'BlendPct' ];
110
- const tmpDrift = [];
111
- tmpSavedRows.forEach((pSavedRow, pIndex) =>
112
- {
113
- if (pIndex === 3)
114
- {
115
- return;
116
- }
117
- for (const tmpKey of tmpKept)
118
- {
119
- if (String(pSavedRow[tmpKey] === undefined ? '' : pSavedRow[tmpKey]) !== String(tmpEdited.Rows[pIndex].Data[tmpKey] === undefined ? '' : tmpEdited.Rows[pIndex].Data[tmpKey]))
120
- {
121
- tmpDrift.push(`row ${pIndex} ${tmpKey}: saved ${pSavedRow[tmpKey]} now ${tmpEdited.Rows[pIndex].Data[tmpKey]}`);
122
- }
123
- }
124
- });
125
- return (
126
- [
127
- libCommon.check('opening the saved document shows each saved product in its dropdown', tmpSavedRows.every((pRow, pIndex) => !pRow.Material || (String(tmpOpened.Rows[pIndex].Shown.Material) === String(pRow.Material))), tmpOpened.Rows.map((pRow) => pRow.Shown)),
128
- libCommon.check('saved Material / Producer / DesignYear / BlendPct are not rewritten by opening or by editing another row', tmpDrift.length < 1, tmpDrift),
129
- ].concat(fIntegrity(pResults, pGraph)));
130
- }
131
- });
132
- }
133
- return tmpScenarios;
134
- }
135
-
136
- module.exports = { Host: 'Headlight', Title: 'The generated RNI 1409 manifest under the Headlight host', page: page, scenarios: scenarios };
@@ -1,344 +0,0 @@
1
- /*
2
- Shared scaffolding for the nested-distill sandbox approaches.
3
-
4
- The subject: a tabular group whose rows pick Site -> Pit -> Product, where Site and Pit only exist
5
- inside each Product record's nested Metadata. Every approach is scored on the same scenarios.
6
- */
7
-
8
- const MARSHAL_ROOT = 'AppData.DocumentData.ReportData.FormData';
9
- const ROWS_ADDRESS = 'MixAggregateProportionTable';
10
- const GROUP_HASH = 'Mix_Aggregate_Proportion_Table';
11
- const SECTION_HASH = 'MixAggregateProportion';
12
- const GRAPH_ADDRESS = 'AppData.AggregateProductGraph';
13
- const STATE = 'MI';
14
- const TODAY_TEMPLATE = '{~S:DATEFORMAT(NULL, "YYYY-MM-DD")~}';
15
-
16
- /**
17
- * The form-level bundle: every product of the state's organizations, current or not (so a saved or reloaded
18
- * choice always resolves), flattened one row per product into the graph. What is offered is scoped by facets.
19
- *
20
- * @return {Array<Record<string, any>>}
21
- */
22
- function graphBundle()
23
- {
24
- const tmpProjection = (pInputAddress) => (
25
- {
26
- Type: 'ProjectDataset',
27
- InputRecordsetAddress: pInputAddress,
28
- OutputRecordsetAddress: GRAPH_ADDRESS,
29
- RecordPrototypeAddress: 'OutputRecordset[]<<~?IDProduct,==,{~D:InputRecord.IDProduct~}?~>>',
30
- RecordFieldMapping:
31
- {
32
- Default:
33
- {
34
- 'InputRecord.IDProduct': 'OutputRecord.IDProduct',
35
- 'InputRecord.Name': 'OutputRecord.Name',
36
- 'InputRecord.IDOrganization': 'OutputRecord.IDOrganization',
37
- 'InputRecord.EffectiveDate': 'OutputRecord.EffectiveDate',
38
- 'InputRecord.ExpirationDate': 'OutputRecord.ExpirationDate',
39
- 'InputRecord.Metadata.State': 'OutputRecord.State',
40
- 'InputRecord.Metadata.Source': 'OutputRecord.Source',
41
- 'InputRecord.Metadata.Current.Site': 'OutputRecord.Site',
42
- 'InputRecord.Metadata.PitNumber': 'OutputRecord.PitNumber',
43
- 'InputRecord.Metadata.DesignYear': 'OutputRecord.DesignYear',
44
- 'InputRecord.Metadata.Current.Gsb.Use': 'OutputRecord.Gsb',
45
- }
46
- }
47
- });
48
- return (
49
- [
50
- {
51
- Entity: 'Organization',
52
- Filter: `FBV~State~EQ~${STATE}`,
53
- Destination: 'AppData.AggregateGraphSource.Organizations'
54
- },
55
- {
56
- Entity: 'Product',
57
- Filter: 'FBL~IDOrganization~INN~0,{~PJU:,^IDOrganization^AppData.AggregateGraphSource.Organizations~}',
58
- Destination: 'AppData.AggregateGraphSource.Products'
59
- },
60
- tmpProjection('AppData.AggregateGraphSource.Products'),
61
- ]);
62
- }
63
-
64
- /**
65
- * The same flattening, done directly, so checks have an independent expectation to compare to.
66
- *
67
- * @param {Record<string, Array<any>>} pResponses
68
- * @return {Array<Record<string, any>>}
69
- */
70
- function expectedGraph(pResponses)
71
- {
72
- const tmpByID = {};
73
- for (const tmpKey of Object.keys(pResponses))
74
- {
75
- if (!tmpKey.startsWith('Product|') || (tmpKey === 'Product|'))
76
- {
77
- continue;
78
- }
79
- for (const tmpRecord of pResponses[tmpKey])
80
- {
81
- const tmpMetadata = tmpRecord.Metadata || {};
82
- const tmpCurrent = tmpMetadata.Current || {};
83
- tmpByID[tmpRecord.IDProduct] =
84
- {
85
- IDProduct: tmpRecord.IDProduct,
86
- Name: tmpRecord.Name,
87
- IDOrganization: tmpRecord.IDOrganization,
88
- EffectiveDate: tmpRecord.EffectiveDate,
89
- ExpirationDate: tmpRecord.ExpirationDate,
90
- State: tmpMetadata.State,
91
- Source: tmpMetadata.Source,
92
- Site: tmpCurrent.Site,
93
- PitNumber: tmpMetadata.PitNumber,
94
- DesignYear: tmpMetadata.DesignYear,
95
- Gsb: tmpCurrent.Gsb ? tmpCurrent.Gsb.Use : undefined,
96
- };
97
- }
98
- }
99
- return Object.values(tmpByID);
100
- }
101
-
102
- /**
103
- * @param {Array<any>} pValues
104
- * @return {Array<string>}
105
- */
106
- function distinctStrings(pValues)
107
- {
108
- return Array.from(new Set(pValues.filter((pValue) => (pValue !== undefined) && (pValue !== null) && (pValue !== '')).map(String))).sort();
109
- }
110
-
111
- /**
112
- * @param {Array<Record<string, any>>} pGraph
113
- * @param {Record<string, any>} pConstraints - graph field -> required value; empty values are ignored
114
- * @return {Array<Record<string, any>>}
115
- */
116
- function matching(pGraph, pConstraints)
117
- {
118
- return pGraph.filter((pRow) =>
119
- {
120
- for (const tmpField of Object.keys(pConstraints))
121
- {
122
- const tmpValue = pConstraints[tmpField];
123
- if ((tmpValue === undefined) || (tmpValue === null) || (tmpValue === ''))
124
- {
125
- continue;
126
- }
127
- if (String(pRow[tmpField]) !== String(tmpValue))
128
- {
129
- return false;
130
- }
131
- }
132
- return true;
133
- });
134
- }
135
-
136
- /**
137
- * Picks the real records each scenario exercises, from whatever the server returned today.
138
- *
139
- * @param {Array<Record<string, any>>} pGraph
140
- * @param {Array<Record<string, any>>} pCatalog - every product (test-only read) to find an expired one
141
- * @return {Record<string, any>}
142
- */
143
- function pickFixtures(pGraph, pCatalog)
144
- {
145
- const tmpState = pGraph.filter((pRow) => (pRow.State === STATE) && pRow.Site && pRow.PitNumber && (pRow.ExpirationDate >= '2026-09-25'));
146
- const tmpWithGsb = tmpState.filter((pRow) => pRow.Gsb !== undefined);
147
- const tmpSitePits = {};
148
- for (const tmpRow of tmpState)
149
- {
150
- tmpSitePits[tmpRow.Site] = tmpSitePits[tmpRow.Site] || new Set();
151
- tmpSitePits[tmpRow.Site].add(tmpRow.PitNumber);
152
- }
153
- const tmpMultiPitSite = Object.keys(tmpSitePits).sort().find((pSite) => tmpSitePits[pSite].size >= 2);
154
- const tmpPitsOfSite = Array.from(tmpSitePits[tmpMultiPitSite]).sort();
155
- const tmpCount = (pSite, pPit) => matching(tmpState, { Site: pSite, PitNumber: pPit }).length;
156
- const tmpUniquePit = tmpPitsOfSite.find((pPit) => tmpCount(tmpMultiPitSite, pPit) === 1);
157
- const tmpMultiProductPit = tmpPitsOfSite.find((pPit) => tmpCount(tmpMultiPitSite, pPit) >= 2);
158
- const tmpOtherSite = Object.keys(tmpSitePits).sort().find((pSite) => (pSite !== tmpMultiPitSite) && tmpWithGsb.some((pRow) => pRow.Site === pSite));
159
- const tmpProductElsewhere = tmpWithGsb.find((pRow) => pRow.Site === tmpOtherSite) || tmpState.find((pRow) => pRow.Site === tmpOtherSite);
160
- return (
161
- {
162
- MultiPitSite: tmpMultiPitSite,
163
- PitsOfMultiPitSite: tmpPitsOfSite,
164
- UniquePit: tmpUniquePit,
165
- UniquePitProduct: matching(tmpState, { Site: tmpMultiPitSite, PitNumber: tmpUniquePit })[0],
166
- MultiProductPit: tmpMultiProductPit,
167
- OtherSite: tmpOtherSite,
168
- ProductElsewhere: tmpProductElsewhere,
169
- StateGraph: tmpState,
170
- ExpiredProduct: (pCatalog || []).find((pRecord) => pRecord.Metadata && (pRecord.Metadata.State === STATE) && pRecord.Metadata.PitNumber && pRecord.Metadata.Current && pRecord.Metadata.Current.Site && (pRecord.ExpirationDate < '2026-09-25')),
171
- });
172
- }
173
-
174
- /**
175
- * A tabular row manifest. pColumns overrides/extends the PictForm of each column.
176
- *
177
- * @param {Record<string, Record<string, any>>} pColumns - column key -> { Name, DataType, PictForm }
178
- * @return {Record<string, any>}
179
- */
180
- function rowManifest(pColumns)
181
- {
182
- const tmpDescriptors = {};
183
- for (const tmpKey of Object.keys(pColumns))
184
- {
185
- const tmpColumn = pColumns[tmpKey];
186
- tmpDescriptors[tmpKey] =
187
- {
188
- Hash: `${ROWS_ADDRESS}${tmpKey}`,
189
- Name: tmpColumn.Name,
190
- DataAddress: tmpKey,
191
- DataType: tmpColumn.DataType || 'String',
192
- PictForm: Object.assign({ Section: SECTION_HASH, Group: GROUP_HASH, Width: 3 }, tmpColumn.PictForm),
193
- IsTabular: true,
194
- };
195
- }
196
- return { Scope: ROWS_ADDRESS, Descriptors: tmpDescriptors, Sections: [], ReferenceManifests: {} };
197
- }
198
-
199
- /**
200
- * @param {Record<string, any>} pOptions
201
- * @return {Record<string, any>} a whole form manifest
202
- */
203
- function formManifest(pOptions)
204
- {
205
- return (
206
- {
207
- Scope: 'NestedDistillSandbox',
208
- InitialBundle: pOptions.InitialBundle || [],
209
- PickLists: pOptions.PickLists || [],
210
- Descriptors:
211
- {
212
- ProductFilterToday:
213
- {
214
- Hash: 'ProductFilterToday', Name: 'Product Filter Today', DataAddress: 'ProductFilterToday', DataType: 'String',
215
- PictForm: { Section: SECTION_HASH, Group: 'Summary', InputType: 'Hidden', Row: 1 }
216
- },
217
- 'FormulaData.AggregateBlendGsb':
218
- {
219
- Hash: 'FormulaDataAggregateBlendGsb', Name: 'Blend Gsb (summary)', DataAddress: 'FormulaData.AggregateBlendGsb', DataType: 'String',
220
- PictForm: { Section: SECTION_HASH, Group: 'Summary', InputType: 'ReadOnly', Row: 1, Width: 12 }
221
- },
222
- },
223
- Sections:
224
- [
225
- {
226
- Name: 'Mix Aggregate Proportion',
227
- Hash: SECTION_HASH,
228
- Solvers:
229
- [
230
- 'ProductFilterToday=trim(CONCAT(SLICE(STRINGGETSEGMENTS(DATEADDDAYS(GETVALUE("AppData.__NowSeed"), 0), "T"), 0, 1)))',
231
- `FormulaData.AggregateBlendGsb = JOIN(",", flatten(${ROWS_ADDRESS}[].Gsb))`
232
- ].concat(pOptions.SectionSolvers || []),
233
- Groups:
234
- [
235
- {
236
- Name: 'Mix Aggregate Proportion Table',
237
- Hash: GROUP_HASH,
238
- Layout: 'Tabular',
239
- RecordSetAddress: ROWS_ADDRESS,
240
- RecordManifest: ROWS_ADDRESS,
241
- MinimumRowCount: 4,
242
- RecordSetSolvers: pOptions.RecordSetSolvers || [],
243
- },
244
- { Name: 'Summary', Hash: 'Summary', Rows: [] }
245
- ]
246
- }
247
- ],
248
- ReferenceManifests: { [ROWS_ADDRESS]: rowManifest(pOptions.Columns) },
249
- });
250
- }
251
-
252
- /**
253
- * @param {Array<Record<string, any>>} pRows
254
- * @return {Record<string, any>}
255
- */
256
- function appData(pRows)
257
- {
258
- return { DocumentData: { ReportData: { FormData: { [ROWS_ADDRESS]: pRows || [ {}, {}, {}, {} ] } } } };
259
- }
260
-
261
- /**
262
- * @param {string} pLabel
263
- * @param {boolean} pPassed
264
- * @param {any} [pDetail]
265
- * @param {boolean} [pExpected] - false marks a known limitation of the approach (reported, not a failure)
266
- * @return {Record<string, any>}
267
- */
268
- function check(pLabel, pPassed, pDetail, pExpected)
269
- {
270
- return { Label: pLabel, Passed: !!pPassed, Detail: pPassed ? undefined : pDetail, Expected: pExpected };
271
- }
272
-
273
- /**
274
- * @param {Record<string, any>} pResults
275
- * @param {string} pLabel
276
- * @return {Record<string, any>}
277
- */
278
- function snapshot(pResults, pLabel)
279
- {
280
- const tmpSnapshot = pResults.Snapshots.find((pEntry) => pEntry.Label === pLabel);
281
- if (!tmpSnapshot)
282
- {
283
- throw new Error(`No snapshot [${pLabel}] (have ${pResults.Snapshots.map((pEntry) => pEntry.Label).join(', ')})`);
284
- }
285
- return tmpSnapshot;
286
- }
287
-
288
- /**
289
- * @param {Array<any>} pLeft
290
- * @param {Array<any>} pRight
291
- * @return {boolean}
292
- */
293
- function sameSet(pLeft, pRight)
294
- {
295
- return JSON.stringify(distinctStrings(pLeft || [])) === JSON.stringify(distinctStrings(pRight || []));
296
- }
297
-
298
- /**
299
- * Integrity invariants that must hold on every snapshot, whatever the approach:
300
- * - what a dropdown shows is what the row stores (no hidden value behind a blank control), and
301
- * - a row's Site / Pit / Product never describe different products.
302
- *
303
- * @param {Record<string, any>} pResults
304
- * @param {Array<Record<string, any>>} pGraph
305
- * @param {Array<string>} pSelectColumns
306
- * @param {boolean} [pExpected]
307
- * @return {Array<Record<string, any>>}
308
- */
309
- function integrityChecks(pResults, pGraph, pSelectColumns, pExpected)
310
- {
311
- const tmpHidden = [];
312
- const tmpInconsistent = [];
313
- for (const tmpSnapshot of pResults.Snapshots)
314
- {
315
- tmpSnapshot.Rows.forEach((pRow, pIndex) =>
316
- {
317
- for (const tmpColumn of pSelectColumns)
318
- {
319
- const tmpStored = pRow.Data[tmpColumn];
320
- if ((tmpStored !== undefined) && (tmpStored !== '') && (String(pRow.Shown[tmpColumn]) !== String(tmpStored)))
321
- {
322
- tmpHidden.push(`${tmpSnapshot.Label} row ${pIndex} ${tmpColumn}: stores ${tmpStored}, shows ${pRow.Shown[tmpColumn]}`);
323
- }
324
- }
325
- const tmpConstraints = { Site: pRow.Data.Site, PitNumber: pRow.Data.PitNumber, IDProduct: pRow.Data.Material };
326
- if ((pRow.Data.Material || pRow.Data.Site || pRow.Data.PitNumber) && (matching(pGraph, tmpConstraints).length < 1))
327
- {
328
- tmpInconsistent.push(`${tmpSnapshot.Label} row ${pIndex}: ${JSON.stringify(tmpConstraints)}`);
329
- }
330
- });
331
- }
332
- return (
333
- [
334
- check('every dropdown shows the value its row stores', tmpHidden.length < 1, tmpHidden.slice(0, 4), pExpected),
335
- check('no row holds a Site / Pit / Product combination that does not exist', tmpInconsistent.length < 1, tmpInconsistent.slice(0, 4), pExpected),
336
- ]);
337
- }
338
-
339
- module.exports =
340
- {
341
- MARSHAL_ROOT, ROWS_ADDRESS, GROUP_HASH, SECTION_HASH, GRAPH_ADDRESS, STATE, TODAY_TEMPLATE,
342
- graphBundle, expectedGraph, distinctStrings, matching, pickFixtures, rowManifest, formManifest, appData,
343
- check, snapshot, sameSet, integrityChecks,
344
- };