Skip to content

Commit

Permalink
reactivate old test, remove deprecated toThrowError() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
jadeddelta committed Jan 10, 2025
1 parent ad1d854 commit c8bda3c
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/jspsych/src/timeline/Timeline.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,10 +586,10 @@ describe("Timeline", () => {
const variable = new TimelineVariable("x");

await timeline.run();
expect(() => timeline.evaluateTimelineVariable(variable)).toThrowError("");
expect(() => timeline.evaluateTimelineVariable(variable)).toThrow();
expect(() =>
(timeline.children[0] as Timeline).evaluateTimelineVariable(variable)
).toThrowError("");
).toThrow();
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/jspsych/src/timeline/Trial.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ describe("Trial", () => {
);
await expect(
createTrial({ type: TestPlugin, requiredComplexNested: {} }).run()
).rejects.toThrowError('"requiredComplexNested.requiredChild" parameter');
).rejects.toThrow('"requiredComplexNested.requiredChild" parameter');
});

it("errors on missing parameters nested in `COMPLEX` array parameters", async () => {
Expand Down
9 changes: 4 additions & 5 deletions packages/jspsych/tests/core/timeline-variables.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,7 @@ describe("timeline variables are correctly evaluated", () => {
});
});

// using console.warn instead of error for now. plan is to enable this test with version 8.
test.skip("timelineVariable() throws an error when variable doesn't exist", async () => {
test("throws an error when variable doesn't exist", async () => {
const jsPsych = initJsPsych();
const { expectFinished } = await startTimeline(
[
Expand All @@ -411,7 +410,7 @@ test.skip("timelineVariable() throws an error when variable doesn't exist", asyn
type: htmlKeyboardResponse,
stimulus: "foo",
on_start: () => {
expect(() => jsPsych.evaluateTimelineVariable("c")).toThrowError();
expect(() => jsPsych.evaluateTimelineVariable("c")).toThrow();
},
},
],
Expand All @@ -430,7 +429,7 @@ test.skip("timelineVariable() throws an error when variable doesn't exist", asyn
await expectFinished();
});

test("timelineVariable() can fetch a variable called 'data'", async () => {
test("can fetch a variable called 'data'", async () => {
const jsPsych = initJsPsych();
const { expectFinished } = await startTimeline(
[
Expand All @@ -440,7 +439,7 @@ test("timelineVariable() can fetch a variable called 'data'", async () => {
type: htmlKeyboardResponse,
stimulus: "foo",
on_start: () => {
expect(() => jsPsych.evaluateTimelineVariable("data")).not.toThrowError();
expect(() => jsPsych.evaluateTimelineVariable("data")).not.toThrow();
},
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/jspsych/tests/randomization/randomization.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe("randomInt", () => {
test("setting upper < lower throws an error", () => {
expect(() => {
randomInt(1, 0);
}).toThrowError();
}).toThrow();
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-video-keyboard-response/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe("video-keyboard-response", () => {

await expect(async () => {
await jsPsych.run(timeline);
}).rejects.toThrowError();
}).rejects.toThrow();
});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-video-slider-response/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("video-slider-response", () => {

await expect(async () => {
await jsPsych.run(timeline);
}).rejects.toThrowError();
}).rejects.toThrow();
});
});

Expand Down

0 comments on commit c8bda3c

Please sign in to comment.