Skip to content

Commit

Permalink
add test for #3167 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
jodeleeuw committed Nov 10, 2023
1 parent 6f9d01b commit e3b2acc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/jspsych/src/timeline/Timeline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,19 @@ describe("Timeline", () => {
expect(onTimelineFinish).toHaveBeenCalledTimes(1);
});

it("loop function ignores data from trials where `record_data` is false", async () => {
const loopFunction = jest.fn();
loopFunction.mockReturnValue(false);

const timeline = createTimeline({
timeline: [{ type: TestPlugin, record_data: false }, { type: TestPlugin }],
loop_function: loopFunction,
});

await timeline.run();
expect((loopFunction.mock.calls[0][0] as DataCollection).count()).toBe(1);
});

describe("with timeline variables", () => {
it("repeats all trials for each set of variables", async () => {
const xValues = [];
Expand Down

0 comments on commit e3b2acc

Please sign in to comment.