mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 16:10:07 +00:00
test(probe): pin the presence label the sampler matches
The probe samples a presenceSet pair's flag as true by matching the tuple label "present" by name, so a rename in the repository helper would silently stop every partial update from reaching its SQL. The label is now exported from arg-samples.ts, and a probe test reads the real presence-set.ts and fails if no named tuple member carries it.
This commit is contained in:
@@ -28,9 +28,10 @@ const MAX_DEPTH = 4;
|
||||
/**
|
||||
* The label of the flag in the repositories' `[present: boolean, value]`
|
||||
* pairs (`presenceSet`): a patch whose pairs are all absent sends no SQL, so
|
||||
* this one boolean is sampled true. Every other boolean stays false.
|
||||
* this one boolean is sampled true. Every other boolean stays false. The
|
||||
* label is spelled in `presenceSet`'s signature, which a test pins.
|
||||
*/
|
||||
const PRESENCE_LABEL = 'present';
|
||||
export const PRESENCE_LABEL = 'present';
|
||||
const SAMPLE_DATE = '2026-01-01';
|
||||
const SAMPLE_TIMESTAMP = '2026-01-01 00:00:00';
|
||||
|
||||
@@ -98,7 +99,12 @@ function sampleObjectType(checker: ts.TypeChecker, type: ts.ObjectType, name: st
|
||||
const labels = ((type as ts.TypeReference).target as ts.TupleType).labeledElementDeclarations;
|
||||
for (const [i, element] of checker.getTypeArguments(type as ts.TypeReference).entries()) {
|
||||
const label = labels?.[i]?.name;
|
||||
const sample = sampleFor(checker, element, label && ts.isIdentifier(label) ? label.text : `${name}[${i}]`, depth + 1);
|
||||
const sample = sampleFor(
|
||||
checker,
|
||||
element,
|
||||
label && ts.isIdentifier(label) ? label.text : `${name}[${i}]`,
|
||||
depth + 1,
|
||||
);
|
||||
if (!sample.ok) return sample;
|
||||
values.push(sample.value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user