@adminiumjs/add-on-contracts 0.3.17 → 0.3.18-rc.0
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.
- package/dist/add-on-block.d.ts +82 -10
- package/dist/add-on-block.d.ts.map +1 -1
- package/dist/add-on-block.js +66 -10
- package/dist/add-on-block.js.map +1 -1
- package/dist/common.d.ts +17 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/common.js +17 -0
- package/dist/common.js.map +1 -1
- package/dist/contracts.d.ts +13 -1
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +27 -1
- package/dist/contracts.js.map +1 -1
- package/dist/document-render.d.ts +8 -7
- package/dist/document-render.d.ts.map +1 -1
- package/dist/document-render.js +2 -2
- package/dist/document-render.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/posting-rows.d.ts +234 -0
- package/dist/posting-rows.d.ts.map +1 -0
- package/dist/posting-rows.js +126 -0
- package/dist/posting-rows.js.map +1 -0
- package/dist/price-adjust.d.ts +274 -0
- package/dist/price-adjust.d.ts.map +1 -0
- package/dist/price-adjust.js +145 -0
- package/dist/price-adjust.js.map +1 -0
- package/dist/record-tabs.d.ts +141 -0
- package/dist/record-tabs.d.ts.map +1 -0
- package/dist/record-tabs.js +167 -0
- package/dist/record-tabs.js.map +1 -0
- package/dist/runtime/data-types.d.ts +240 -0
- package/dist/runtime/data-types.d.ts.map +1 -0
- package/dist/runtime/data-types.js +15 -0
- package/dist/runtime/data-types.js.map +1 -0
- package/dist/runtime/data.d.ts +61 -0
- package/dist/runtime/data.d.ts.map +1 -0
- package/dist/runtime/data.js +61 -0
- package/dist/runtime/data.js.map +1 -0
- package/dist/runtime/index.d.ts +51 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +100 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +2 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/posting-rows.d.ts +34 -0
- package/dist/testing/posting-rows.d.ts.map +1 -0
- package/dist/testing/posting-rows.js +225 -0
- package/dist/testing/posting-rows.js.map +1 -0
- package/dist/testing/price-adjust.d.ts +21 -0
- package/dist/testing/price-adjust.d.ts.map +1 -0
- package/dist/testing/price-adjust.js +71 -0
- package/dist/testing/price-adjust.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* The `posting-rows@1` conformance suite.
|
|
4
|
+
*
|
|
5
|
+
* Run by each add-on's own tests against its provider and its own case
|
|
6
|
+
* table, and by Adminium against its test ledger. A case is an input and
|
|
7
|
+
* what the answer must hold; the suite adds what every provider owes whatever
|
|
8
|
+
* its cases say:
|
|
9
|
+
*
|
|
10
|
+
* - an answer of the declared shape, given at once (never a promise);
|
|
11
|
+
* - rows inside what the ledger declares it writes;
|
|
12
|
+
* - the same answer for the same input, asked twice and asked again under
|
|
13
|
+
* another wall clock: the time is an input, and nothing is left to chance;
|
|
14
|
+
* - a peek that answers as the save does;
|
|
15
|
+
* - a reverse that never refuses, and that gives back what was written:
|
|
16
|
+
* every column the ledger sums comes to zero over a round;
|
|
17
|
+
* - a built file that reaches for no module, no process, no clock and no
|
|
18
|
+
* network.
|
|
19
|
+
*
|
|
20
|
+
* The checks are plain functions that answer what is wrong, in words;
|
|
21
|
+
* {@link postingRowsConformance} registers them as tests.
|
|
22
|
+
*/
|
|
23
|
+
import { describe, expect, it } from 'vitest';
|
|
24
|
+
import { postingOutputSchema, rowsOutsideWrites, } from '../posting-rows.js';
|
|
25
|
+
/** What a built deciding file may not name, and why. */
|
|
26
|
+
const FORBIDDEN = [
|
|
27
|
+
[/\brequire\s*\(/, 'it calls require(): the file is one script with everything inlined'],
|
|
28
|
+
[/\bimport\s*\(/, 'it calls import(): the file is one script with everything inlined'],
|
|
29
|
+
[/^\s*import\s[^;]*?from\s*['"]/m, 'it has an import statement: the file is a classic script, not a module'],
|
|
30
|
+
[/^\s*export\s/m, 'it has an export statement: it assigns module.exports'],
|
|
31
|
+
[/\bprocess\s*\./, 'it reads process: there is none where it runs'],
|
|
32
|
+
[/\bnew\s+Date\b|\bDate\s*\.\s*now\b|\bglobalThis\s*\.\s*Date\b/, 'it reads the clock: the time is an input (now, today, zone)'],
|
|
33
|
+
[/\bMath\s*\.\s*random\b/, 'it asks for a random number: the same input must give the same answer'],
|
|
34
|
+
[/\bfetch\s*\(/, 'it calls fetch(): there is no network where it runs'],
|
|
35
|
+
];
|
|
36
|
+
/** Everything wrong with the built file's text. */
|
|
37
|
+
export function postingSourceIssues(source) {
|
|
38
|
+
return FORBIDDEN.filter(([pattern]) => pattern.test(source)).map(([, why]) => why);
|
|
39
|
+
}
|
|
40
|
+
/** A decimal written as text, as a whole number of the smallest step both hold. */
|
|
41
|
+
function scaled(text, places) {
|
|
42
|
+
const negative = text.startsWith('-');
|
|
43
|
+
const [whole = '0', fraction = ''] = (negative ? text.slice(1) : text).split('.');
|
|
44
|
+
const value = BigInt(whole + fraction.padEnd(places, '0'));
|
|
45
|
+
return negative ? -value : value;
|
|
46
|
+
}
|
|
47
|
+
/** The sum of decimals written as text; null when one is not a decimal. */
|
|
48
|
+
function sumOf(values) {
|
|
49
|
+
const texts = values.map((value) => (typeof value === 'number' ? String(value) : value));
|
|
50
|
+
if (!texts.every((value) => typeof value === 'string' && /^-?\d+(\.\d+)?$/.test(value)))
|
|
51
|
+
return null;
|
|
52
|
+
const places = Math.max(0, ...texts.map((text) => (text.split('.')[1] ?? '').length));
|
|
53
|
+
return texts.reduce((sum, text) => sum + scaled(text, places), 0n);
|
|
54
|
+
}
|
|
55
|
+
/** Runs `run` with a wall clock that says something else on every reading. */
|
|
56
|
+
function underAnotherClock(start, run) {
|
|
57
|
+
const RealDate = Date;
|
|
58
|
+
let ticks = 0;
|
|
59
|
+
const reading = () => start + (ticks += 1) * 86_400_000;
|
|
60
|
+
class OtherDate extends RealDate {
|
|
61
|
+
constructor(...args) {
|
|
62
|
+
if (args.length === 0)
|
|
63
|
+
super(reading());
|
|
64
|
+
else
|
|
65
|
+
super(...args);
|
|
66
|
+
}
|
|
67
|
+
static now() {
|
|
68
|
+
return reading();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
globalThis.Date = OtherDate;
|
|
72
|
+
try {
|
|
73
|
+
return run();
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
globalThis.Date = RealDate;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/** The answer to one input, and why it is no answer when it is none. */
|
|
80
|
+
function ask(provider, input) {
|
|
81
|
+
let output;
|
|
82
|
+
try {
|
|
83
|
+
output = provider.rows(structuredClone(input));
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
return { problem: `it threw: ${error instanceof Error ? error.message : String(error)}` };
|
|
87
|
+
}
|
|
88
|
+
if (output !== null && typeof output === 'object' && typeof output.then === 'function') {
|
|
89
|
+
return { problem: 'it answered with a promise: the call is synchronous' };
|
|
90
|
+
}
|
|
91
|
+
const parsed = postingOutputSchema.safeParse(output);
|
|
92
|
+
if (!parsed.success) {
|
|
93
|
+
const first = parsed.error.issues[0];
|
|
94
|
+
return { problem: `the answer is not of the declared shape: ${(first?.path ?? []).join('.')}: ${first?.message ?? ''}` };
|
|
95
|
+
}
|
|
96
|
+
return { output: parsed.data };
|
|
97
|
+
}
|
|
98
|
+
/** What a round wrote, as the engine hands it back on a reverse: each inserted row, with a key of its own. */
|
|
99
|
+
function writtenBy(output) {
|
|
100
|
+
const written = {};
|
|
101
|
+
for (const row of output.rows) {
|
|
102
|
+
if (row.op !== 'insert')
|
|
103
|
+
continue;
|
|
104
|
+
const list = (written[row.table] ??= []);
|
|
105
|
+
const values = { id: list.length + 1 };
|
|
106
|
+
for (const [column, value] of Object.entries(row.values))
|
|
107
|
+
values[column] = value !== null && typeof value === 'object' ? null : value;
|
|
108
|
+
list.push(values);
|
|
109
|
+
}
|
|
110
|
+
return written;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Everything one case shows wrong with a provider, in words; empty when it
|
|
114
|
+
* holds. Pure: it registers no test, so a suite can be tried on a provider
|
|
115
|
+
* that is wrong on purpose.
|
|
116
|
+
*/
|
|
117
|
+
export function postingCaseIssues(provider, options, one) {
|
|
118
|
+
const issues = [];
|
|
119
|
+
if (typeof provider.rows !== 'function')
|
|
120
|
+
return ['the provider has no `rows`'];
|
|
121
|
+
const ledger = options.ledgers[one.input.ledger];
|
|
122
|
+
if (ledger === undefined)
|
|
123
|
+
return [`the case names the ledger "${one.input.ledger}", which the suite was not told of`];
|
|
124
|
+
const first = ask(provider, one.input);
|
|
125
|
+
if ('problem' in first)
|
|
126
|
+
return [first.problem];
|
|
127
|
+
const { output } = first;
|
|
128
|
+
issues.push(...rowsOutsideWrites(output, ledger.writes));
|
|
129
|
+
// The same input, the same answer: asked again, and asked under two other wall clocks.
|
|
130
|
+
const again = ask(provider, one.input);
|
|
131
|
+
if ('problem' in again)
|
|
132
|
+
issues.push(`asked again, ${again.problem}`);
|
|
133
|
+
else if (JSON.stringify(again.output) !== JSON.stringify(output))
|
|
134
|
+
issues.push('the same input gave another answer the second time');
|
|
135
|
+
for (const start of [946_684_800_000, 4_102_444_800_000]) {
|
|
136
|
+
const other = underAnotherClock(start, () => ask(provider, one.input));
|
|
137
|
+
if ('problem' in other)
|
|
138
|
+
issues.push(`under another wall clock, ${other.problem}`);
|
|
139
|
+
else if (JSON.stringify(other.output) !== JSON.stringify(output)) {
|
|
140
|
+
issues.push('the answer changes with the wall clock: the time is an input (now, today, zone)');
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (one.input.mode === 'save') {
|
|
145
|
+
const peek = ask(provider, { ...one.input, mode: 'peek' });
|
|
146
|
+
if ('problem' in peek)
|
|
147
|
+
issues.push(`as a peek, ${peek.problem}`);
|
|
148
|
+
else if (JSON.stringify(peek.output) !== JSON.stringify(output))
|
|
149
|
+
issues.push('a peek answers differently from the save');
|
|
150
|
+
}
|
|
151
|
+
if (one.input.phase === 'reverse') {
|
|
152
|
+
if ((output.refusals ?? []).length > 0)
|
|
153
|
+
issues.push('a reverse refuses: what was written is always given back');
|
|
154
|
+
}
|
|
155
|
+
else if ((output.refusals ?? []).length === 0 && one.input.mode !== 'words') {
|
|
156
|
+
// What this case wrote, handed back: the reverse never refuses, and every summed column comes to zero.
|
|
157
|
+
const written = writtenBy(output);
|
|
158
|
+
const back = ask(provider, { ...one.input, phase: 'reverse', written });
|
|
159
|
+
if ('problem' in back)
|
|
160
|
+
issues.push(`reversing what it wrote, ${back.problem}`);
|
|
161
|
+
else {
|
|
162
|
+
if ((back.output.refusals ?? []).length > 0)
|
|
163
|
+
issues.push('the reverse of what it wrote refuses: what was written is always given back');
|
|
164
|
+
issues.push(...rowsOutsideWrites(back.output, ledger.writes).map((issue) => `the reverse: ${issue}`));
|
|
165
|
+
for (const [table, columns] of Object.entries(ledger.sums ?? {})) {
|
|
166
|
+
for (const column of columns) {
|
|
167
|
+
const values = [...output.rows, ...back.output.rows].flatMap((row) => (row.op === 'insert' && row.table === table && row.values[column] !== undefined ? [row.values[column]] : []));
|
|
168
|
+
const sum = sumOf(values);
|
|
169
|
+
if (sum === null)
|
|
170
|
+
issues.push(`"${table}.${column}" adds up to a balance: every row gives it as a decimal`);
|
|
171
|
+
else if (sum !== 0n)
|
|
172
|
+
issues.push(`over the round and its reverse "${table}.${column}" does not come to zero`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (one.expect.rows !== undefined) {
|
|
178
|
+
if (output.rows.length !== one.expect.rows.length)
|
|
179
|
+
issues.push(`the case expects ${String(one.expect.rows.length)} rows; the answer has ${String(output.rows.length)}`);
|
|
180
|
+
else
|
|
181
|
+
one.expect.rows.forEach((row, i) => !holds(output.rows[i], row) && issues.push(`row ${String(i)} is not what the case expects`));
|
|
182
|
+
}
|
|
183
|
+
if (one.expect.refusals !== undefined) {
|
|
184
|
+
const refusals = output.refusals ?? [];
|
|
185
|
+
if (refusals.length !== one.expect.refusals.length)
|
|
186
|
+
issues.push(`the case expects ${String(one.expect.refusals.length)} refusals; the answer has ${String(refusals.length)}`);
|
|
187
|
+
else
|
|
188
|
+
one.expect.refusals.forEach((refusal, i) => !holds(refusals[i], refusal) && issues.push(`refusal ${String(i)} is not what the case expects`));
|
|
189
|
+
}
|
|
190
|
+
return issues;
|
|
191
|
+
}
|
|
192
|
+
/** Whether `actual` holds everything `expected` names, at any depth. */
|
|
193
|
+
function holds(actual, expected) {
|
|
194
|
+
if (expected === null || typeof expected !== 'object')
|
|
195
|
+
return actual === expected;
|
|
196
|
+
if (actual === null || typeof actual !== 'object')
|
|
197
|
+
return false;
|
|
198
|
+
if (Array.isArray(expected))
|
|
199
|
+
return Array.isArray(actual) && actual.length === expected.length && expected.every((item, i) => holds(actual[i], item));
|
|
200
|
+
return Object.entries(expected).every(([key, value]) => holds(actual[key], value));
|
|
201
|
+
}
|
|
202
|
+
/** Registers the suite's tests for one provider. Call it inside a test file. */
|
|
203
|
+
export function postingRowsConformance(provider, options) {
|
|
204
|
+
describe('posting-rows@1', () => {
|
|
205
|
+
it('is a provider with a synchronous `rows`', () => {
|
|
206
|
+
expect(typeof provider.rows).toBe('function');
|
|
207
|
+
});
|
|
208
|
+
it('has at least one case for every ledger it serves', () => {
|
|
209
|
+
const cased = new Set(options.cases.map((one) => one.input.ledger));
|
|
210
|
+
expect(Object.keys(options.ledgers).filter((id) => !cased.has(id))).toEqual([]);
|
|
211
|
+
});
|
|
212
|
+
if (options.source !== undefined) {
|
|
213
|
+
const source = options.source;
|
|
214
|
+
it('ships a file that reaches for no module, no process, no clock and no network', () => {
|
|
215
|
+
expect(postingSourceIssues(source)).toEqual([]);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
for (const one of options.cases) {
|
|
219
|
+
it(one.name, () => {
|
|
220
|
+
expect(postingCaseIssues(provider, options, one)).toEqual([]);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=posting-rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posting-rows.js","sourceRoot":"","sources":["../../src/testing/posting-rows.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAOlB,MAAM,oBAAoB,CAAC;AAwB5B,wDAAwD;AACxD,MAAM,SAAS,GAAgC;IAC7C,CAAC,gBAAgB,EAAE,oEAAoE,CAAC;IACxF,CAAC,eAAe,EAAE,mEAAmE,CAAC;IACtF,CAAC,gCAAgC,EAAE,wEAAwE,CAAC;IAC5G,CAAC,eAAe,EAAE,uDAAuD,CAAC;IAC1E,CAAC,gBAAgB,EAAE,+CAA+C,CAAC;IACnE,CAAC,+DAA+D,EAAE,6DAA6D,CAAC;IAChI,CAAC,wBAAwB,EAAE,uEAAuE,CAAC;IACnG,CAAC,cAAc,EAAE,qDAAqD,CAAC;CACxE,CAAC;AAEF,mDAAmD;AACnD,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;AACrF,CAAC;AAED,mFAAmF;AACnF,SAAS,MAAM,CAAC,IAAY,E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ChD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;YAC1D,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;YACpE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAClF,CAAC,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC9B,EAAE,CAAC,8EAA8E,EAAE,GAAG,EAAE;gBACtF,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC;QACL,CAAC;QAED,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;YAChC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE;gBAChB,MAAM,CAAC,iBAAiB,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type AdjustApplied, type AdjustInput, type PriceAdjustProvider } from '../price-adjust.js';
|
|
2
|
+
export interface PriceAdjustCase {
|
|
3
|
+
name: string;
|
|
4
|
+
input: AdjustInput;
|
|
5
|
+
/** What the answer must hold: the order's reduction, each line's, what was applied (a subset of each entry's keys), what was refused. */
|
|
6
|
+
expect: {
|
|
7
|
+
order?: string;
|
|
8
|
+
lines?: Readonly<Record<string, string>>;
|
|
9
|
+
applied?: readonly Partial<AdjustApplied>[];
|
|
10
|
+
refused?: readonly {
|
|
11
|
+
typed: string;
|
|
12
|
+
reason: string;
|
|
13
|
+
}[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface PriceAdjustConformanceOptions {
|
|
17
|
+
cases: readonly PriceAdjustCase[];
|
|
18
|
+
}
|
|
19
|
+
/** Registers the suite's tests for one adjuster. Call it inside a test file. */
|
|
20
|
+
export declare function priceAdjustConformance(provider: PriceAdjustProvider, options: PriceAdjustConformanceOptions): void;
|
|
21
|
+
//# sourceMappingURL=price-adjust.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price-adjust.d.ts","sourceRoot":"","sources":["../../src/testing/price-adjust.ts"],"names":[],"mappings":"AAaA,OAAO,EAA0C,KAAK,aAAa,EAAE,KAAK,WAAW,EAAqB,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE/J,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,WAAW,CAAC;IACnB,yIAAyI;IACzI,MAAM,EAAE;QACN,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QACzC,OAAO,CAAC,EAAE,SAAS,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QAC5C,OAAO,CAAC,EAAE,SAAS;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;KACxD,CAAC;CACH;AAED,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;CACnC;AAED,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,mBAAmB,EAAE,OAAO,EAAE,6BAA6B,GAAG,IAAI,CAsDlH"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* The `price-adjust@1` conformance suite.
|
|
4
|
+
*
|
|
5
|
+
* Run by an adjuster's own tests against its own case table. A case is a
|
|
6
|
+
* question and what the answer must hold; the suite adds what every adjuster
|
|
7
|
+
* owes whatever its cases say: an answer of the declared shape, one reduction
|
|
8
|
+
* per line and never more than the line, excluded lines untouched, an order
|
|
9
|
+
* total that is the lines' sum, the same answer to the same question, and a
|
|
10
|
+
* dry run that prices as the save does.
|
|
11
|
+
*/
|
|
12
|
+
import { describe, expect, it } from 'vitest';
|
|
13
|
+
import { adjustAnswerIssues, adjustOutputSchema } from '../price-adjust.js';
|
|
14
|
+
/** Registers the suite's tests for one adjuster. Call it inside a test file. */
|
|
15
|
+
export function priceAdjustConformance(provider, options) {
|
|
16
|
+
const answer = (input) => {
|
|
17
|
+
const output = provider.adjust(structuredClone(input));
|
|
18
|
+
expect(typeof output?.then, 'the call is synchronous: it returns the answer, never a promise').not.toBe('function');
|
|
19
|
+
return output;
|
|
20
|
+
};
|
|
21
|
+
describe('price-adjust@1', () => {
|
|
22
|
+
it('is a provider with a synchronous `adjust`', () => {
|
|
23
|
+
expect(typeof provider.adjust).toBe('function');
|
|
24
|
+
});
|
|
25
|
+
for (const one of options.cases) {
|
|
26
|
+
describe(one.name, () => {
|
|
27
|
+
it('answers in the declared shape', () => {
|
|
28
|
+
const parsed = adjustOutputSchema.safeParse(answer(one.input));
|
|
29
|
+
expect(parsed.success ? [] : parsed.error.issues).toEqual([]);
|
|
30
|
+
});
|
|
31
|
+
it('reduces each line once, never past its amount, and the order by their sum', () => {
|
|
32
|
+
expect(adjustAnswerIssues(one.input, answer(one.input))).toEqual([]);
|
|
33
|
+
});
|
|
34
|
+
it('gives the same answer to the same question', () => {
|
|
35
|
+
expect(answer(one.input)).toEqual(answer(one.input));
|
|
36
|
+
});
|
|
37
|
+
it('prices a dry run as it prices the save', () => {
|
|
38
|
+
if (one.input.mode !== 'save' || one.input.point !== 'line')
|
|
39
|
+
return;
|
|
40
|
+
const saved = answer(one.input);
|
|
41
|
+
const dry = answer({ ...one.input, mode: 'dry' });
|
|
42
|
+
expect(dry.lines).toEqual(saved.lines);
|
|
43
|
+
expect(dry.order).toEqual(saved.order);
|
|
44
|
+
});
|
|
45
|
+
it('says of every offer whether it applies, when asked', () => {
|
|
46
|
+
if (!one.input.explain)
|
|
47
|
+
return;
|
|
48
|
+
const explained = new Set((answer(one.input).explain ?? []).map((entry) => entry.offer));
|
|
49
|
+
for (const rows of Object.values(one.input.offers))
|
|
50
|
+
for (const row of rows)
|
|
51
|
+
if (row['id'] !== undefined && row['id'] !== null)
|
|
52
|
+
expect(explained, `offer ${String(row['id'])}`).toContain(String(row['id']));
|
|
53
|
+
});
|
|
54
|
+
it('holds what the case expects', () => {
|
|
55
|
+
const output = answer(one.input);
|
|
56
|
+
if (one.expect.order !== undefined)
|
|
57
|
+
expect(output.order.discount).toBe(one.expect.order);
|
|
58
|
+
for (const [key, discount] of Object.entries(one.expect.lines ?? {}))
|
|
59
|
+
expect(output.lines.find((line) => line.key === key)?.discount, `line ${key}`).toBe(discount);
|
|
60
|
+
if (one.expect.applied !== undefined) {
|
|
61
|
+
expect(output.applied).toHaveLength(one.expect.applied.length);
|
|
62
|
+
one.expect.applied.forEach((applied, i) => expect(output.applied[i]).toMatchObject(applied));
|
|
63
|
+
}
|
|
64
|
+
if (one.expect.refused !== undefined)
|
|
65
|
+
expect(output.refused.map(({ typed, reason }) => ({ typed, reason }))).toEqual(one.expect.refused);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=price-adjust.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price-adjust.js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AM,CAAC,CAAC;wBAC/D,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;oBAC/F,CAAC;oBACD,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS;wBAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAC3I,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminiumjs/add-on-contracts",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.18-rc.0",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,6 +46,10 @@
|
|
|
46
46
|
"types": "./dist/runtime/ui.d.ts",
|
|
47
47
|
"default": "./dist/runtime/ui.js"
|
|
48
48
|
},
|
|
49
|
+
"./runtime/data": {
|
|
50
|
+
"types": "./dist/runtime/data.d.ts",
|
|
51
|
+
"default": "./dist/runtime/data.js"
|
|
52
|
+
},
|
|
49
53
|
"./runtime/router": {
|
|
50
54
|
"types": "./dist/runtime/router.d.ts",
|
|
51
55
|
"default": "./dist/runtime/router.js"
|