Skip to content

Commit

Permalink
feat: Ava test spy
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Jan 24, 2025
1 parent b2cb709 commit c584c2c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/swingset-liveslots/tools/vo-test-harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ import { setupTestLiveslots } from '../test/liveslots-helpers.js';
// is to to help verify that a VO can be garbage collected and then
// reloaded from persistent storage while maintaining functionality.

/**
* A spy wrapping Ava's t for tests that are testing the harness itself.
* @param {import('ava').ExecutionContext} t
*/
export const makeSpy = t => {
const tSpy = {
...t,
fail: msg => {
tSpy.failureMessage = msg;
},
// In Ava 6, assertions throw?
falsy: (check, msg) => {
if (!check) return;
tSpy.falsyMessage = msg;
},
failureMessage: '',
falsyMessage: '',
};
return tSpy;
};

// Testing VO swapping with runVOTest:
//
// Step 1: import the necessary harness paraphernalia
Expand Down

0 comments on commit c584c2c

Please sign in to comment.