diff --git a/packages/jspsych/src/timeline/Trial.spec.ts b/packages/jspsych/src/timeline/Trial.spec.ts index 0a3dda8769..04fdad9f79 100644 --- a/packages/jspsych/src/timeline/Trial.spec.ts +++ b/packages/jspsych/src/timeline/Trial.spec.ts @@ -462,6 +462,21 @@ describe("Trial", () => { ); }); + it("allows null values for parameters with a non-null default value", async () => { + TestPlugin.setParameterInfos({ + allowedNullString: { type: ParameterType.STRING, default: "foo" }, + }); + + const trial = createTrial({ type: TestPlugin, allowedNullString: null }); + await trial.run(); + + expect(trial.pluginInstance.trial).toHaveBeenCalledWith( + expect.anything(), + expect.objectContaining({ allowedNullString: null }), + expect.anything() + ); + }); + describe("with missing required parameters", () => { it("errors on missing simple parameters", async () => { TestPlugin.setParameterInfos({ requiredString: { type: ParameterType.STRING } });