mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
parent
d84827042d
commit
b9fd35af81
@ -436,6 +436,8 @@ describe("Trial", () => {
|
|||||||
return TestPlugin;
|
return TestPlugin;
|
||||||
case "x":
|
case "x":
|
||||||
return "foo";
|
return "foo";
|
||||||
|
case "y":
|
||||||
|
return ["foo", "bar"];
|
||||||
default:
|
default:
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@ -444,17 +446,19 @@ describe("Trial", () => {
|
|||||||
const trial = createTrial({
|
const trial = createTrial({
|
||||||
type: new TimelineVariable("t"),
|
type: new TimelineVariable("t"),
|
||||||
requiredString: new TimelineVariable("x"),
|
requiredString: new TimelineVariable("x"),
|
||||||
|
stringArray: new TimelineVariable("y"),
|
||||||
requiredComplexNested: { requiredChild: () => new TimelineVariable("x") },
|
requiredComplexNested: { requiredChild: () => new TimelineVariable("x") },
|
||||||
requiredComplexNestedArray: [{ requiredChild: () => new TimelineVariable("x") }],
|
requiredComplexNestedArray: [{ requiredChild: () => new TimelineVariable("x") }],
|
||||||
});
|
});
|
||||||
|
|
||||||
await trial.run();
|
await trial.run();
|
||||||
|
|
||||||
// The `x` timeline variables should have been replaced with `foo`
|
// The `x` and `y` timeline variables should have been evaluated
|
||||||
expect(trial.pluginInstance.trial).toHaveBeenCalledWith(
|
expect(trial.pluginInstance.trial).toHaveBeenCalledWith(
|
||||||
expect.anything(),
|
expect.anything(),
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
requiredString: "foo",
|
requiredString: "foo",
|
||||||
|
stringArray: ["foo", "bar"],
|
||||||
requiredComplexNested: expect.objectContaining({ requiredChild: "foo" }),
|
requiredComplexNested: expect.objectContaining({ requiredChild: "foo" }),
|
||||||
requiredComplexNestedArray: [expect.objectContaining({ requiredChild: "foo" })],
|
requiredComplexNestedArray: [expect.objectContaining({ requiredChild: "foo" })],
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user