mirror of
https://github.com/civitai/civitai.git
synced 2026-09-20 22:08:18 +08:00
test(app-blocks): give the whatif-declaration guard a positive control
Every assertion in it sits inside a loop over NO_FEE_PATHS, so an emptied ledger would make it pass having checked nothing. The neighbouring ledger test would also go red in that case, which is exactly why the control is explicit: a guard that only fails because a DIFFERENT guard fails is green for the wrong reason. Verified by emptying the ledger - this test now fails on its own assertion (expected [] to deeply equal [submitCustomComfyWorkflow, submitPassThroughStepWorkflow]). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -447,6 +447,16 @@ describe('author fee — the viewer-charge seam', () => {
|
|||||||
// side is removed or reworded.
|
// side is removed or reworded.
|
||||||
const declaration = WHATIF_ATTRIBUTION_DECLARATION.replace(/\s+/g, ' ').trim();
|
const declaration = WHATIF_ATTRIBUTION_DECLARATION.replace(/\s+/g, ' ').trim();
|
||||||
|
|
||||||
|
// POSITIVE CONTROL. Every assertion below sits inside a loop over the ledger,
|
||||||
|
// so an emptied ledger would make this test pass having checked nothing. The
|
||||||
|
// neighbouring ledger test would also go red in that case — which is exactly
|
||||||
|
// why this line is here rather than assumed: a guard that only fails because a
|
||||||
|
// DIFFERENT guard fails is green for the wrong reason.
|
||||||
|
expect(Object.keys(NO_FEE_PATHS)).toEqual([
|
||||||
|
'submitCustomComfyWorkflow',
|
||||||
|
'submitPassThroughStepWorkflow',
|
||||||
|
]);
|
||||||
|
|
||||||
for (const [pathName, entry] of Object.entries(NO_FEE_PATHS)) {
|
for (const [pathName, entry] of Object.entries(NO_FEE_PATHS)) {
|
||||||
const ledgered = entry.whatifAttribution?.trim() ?? '';
|
const ledgered = entry.whatifAttribution?.trim() ?? '';
|
||||||
expect(ledgered, `${pathName}: no ledgered reason for the skip`).not.toBe('');
|
expect(ledgered, `${pathName}: no ledgered reason for the skip`).not.toBe('');
|
||||||
|
|||||||
Reference in New Issue
Block a user