check if getCitations() exists in build

This commit is contained in:
jade 2025-01-08 11:00:43 -07:00
parent 9e60268ba0
commit ac4272fd56

View File

@ -16,12 +16,16 @@ let JsPsych;
* This is because the citation functionality is only available in the built version
* due to code injections that run during the build.
*/
try {
// Try to import built version
JsPsych = require("../../dist/index").JsPsych;
let jspsych: typeof JsPsych;
// Check if getCitations exists in current built version
if (!jspsych.hasOwnProperty("getCitations")) {
throw new Error("getCitations not found");
}
beforeEach(() => {
jspsych = new JsPsych();
});
@ -35,7 +39,7 @@ try {
});
test("citing without input and with invalid format", () => {
expect(() => jspsych.getCitations(null, "apa")).toThrow(
"Expected array of plugins/extensions"
"Expected array of plugins/extensionss"
);
});
});