Skip to content

Commit 007d862

Browse files
committed
Add a getResult[s]() unit test for the record_data: false parameter
1 parent ab7ad5a commit 007d862

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/jspsych/src/timeline/Trial.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,20 @@ describe("Trial", () => {
704704
expect(trial.getResult()).toEqual(expect.objectContaining({ my: "result" }));
705705
expect(trial.getResults()).toEqual([expect.objectContaining({ my: "result" })]);
706706
});
707+
708+
it("does not return the result when the `record_data` trial parameter is `false`", async () => {
709+
TestPlugin.setManualFinishTrialMode();
710+
const trial = createTrial({ type: TestPlugin, record_data: false });
711+
trial.run();
712+
713+
expect(trial.getResult()).toBeUndefined();
714+
expect(trial.getResults()).toEqual([]);
715+
716+
await TestPlugin.finishTrial();
717+
718+
expect(trial.getResult()).toBeUndefined();
719+
expect(trial.getResults()).toEqual([]);
720+
});
707721
});
708722

709723
describe("evaluateTimelineVariable()", () => {

0 commit comments

Comments
 (0)