Skip to content

Commit

Permalink
Add a getResult[s]() unit test for the record_data: false parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoluc committed Dec 6, 2023
1 parent ab7ad5a commit 007d862
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/jspsych/src/timeline/Trial.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,20 @@ describe("Trial", () => {
expect(trial.getResult()).toEqual(expect.objectContaining({ my: "result" }));
expect(trial.getResults()).toEqual([expect.objectContaining({ my: "result" })]);
});

it("does not return the result when the `record_data` trial parameter is `false`", async () => {
TestPlugin.setManualFinishTrialMode();
const trial = createTrial({ type: TestPlugin, record_data: false });
trial.run();

expect(trial.getResult()).toBeUndefined();
expect(trial.getResults()).toEqual([]);

await TestPlugin.finishTrial();

expect(trial.getResult()).toBeUndefined();
expect(trial.getResults()).toEqual([]);
});
});

describe("evaluateTimelineVariable()", () => {
Expand Down

0 comments on commit 007d862

Please sign in to comment.