mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
change citations test to include default jspsych citation
This commit is contained in:
parent
466b44c6ae
commit
5b64a47138
@ -1,11 +1,10 @@
|
||||
//import { JsPsych } from "../../src/JsPsych";
|
||||
import { TestExtension } from "../extensions/TestExtension";
|
||||
import TestPlugin from "../TestPlugin";
|
||||
|
||||
const jsPsychApaCitation =
|
||||
"de Leeuw, J. R., Gilbert, R. A., & Luchterhandt, B. (2023). jsPsych: Enabling an Open-Source Collaborative Ecosystem of Behavioral Experiments. Journal of Open Source Software, 8(85), 5351. https://doi.org/10.21105/joss.05351";
|
||||
"de Leeuw, J. R., Gilbert, R. A., & Luchterhandt, B. (2023). jsPsych: Enabling an Open-Source Collaborative Ecosystem of Behavioral Experiments. Journal of Open Source Software, 8(85), 5351. https://doi.org/10.21105/joss.05351 ";
|
||||
const jsPsychBibtexCitation =
|
||||
'@misc{LeeuwjsPsych, author = {de Leeuw, Joshua R. and Gilbert, Rebecca A. and Luchterhandt, Bj{\\" o}rn}, doi = {10.5281/zenodo.7702307}, title = {jsPsych: Enabling an {Open}-{Source} {Collaborative} {Ecosystem} of {Behavioral} {Experiments}}, } @article{Leeuw2023jsPsych, author = {de Leeuw, Joshua R. and Gilbert, Rebecca A. and Luchterhandt, Bj{\\" o}rn}, journal = {Journal of Open Source Software}, doi = {10.21105/joss.05351}, issn = {2475-9066}, number = {85}, year = {2023}, month = {may 11}, pages = {5351}, publisher = {Open Journals}, title = {jsPsych: Enabling an {Open}-{Source} {Collaborative} {Ecosystem} of {Behavioral} {Experiments}}, url = {https://joss.theoj.org/papers/10.21105/joss.05351}, volume = {8}, } ';
|
||||
'@article{Leeuw2023jsPsych, author = {de Leeuw, Joshua R. and Gilbert, Rebecca A. and Luchterhandt, Bj{\\" o}rn}, journal = {Journal of Open Source Software}, doi = {10.21105/joss.05351}, issn = {2475-9066}, number = {85}, year = {2023}, month = {may 11}, pages = {5351}, publisher = {Open Journals}, title = {jsPsych: Enabling an {Open}-{Source} {Collaborative} {Ecosystem} of {Behavioral} {Experiments}}, url = {https://joss.theoj.org/papers/10.21105/joss.05351}, volume = {8}, } ';
|
||||
const testPluginApaCitation = "Test plugin APA citation";
|
||||
const testPluginBibtexCitation = "Test plugin BibTeX citation";
|
||||
const testExtensionApaCitation = "Test extension APA citation";
|
||||
@ -37,7 +36,10 @@ try {
|
||||
});
|
||||
|
||||
describe("citing not using an array", () => {
|
||||
test("citing nothing", () => {
|
||||
test("citing without input", () => {
|
||||
expect(jspsych.getCitations()).toBe(jsPsychApaCitation);
|
||||
});
|
||||
test("citing null", () => {
|
||||
expect(() => jspsych.getCitations(null)).toThrow("Expected array of plugins/extensions");
|
||||
});
|
||||
test("citing without input and with invalid format", () => {
|
||||
@ -49,20 +51,18 @@ try {
|
||||
|
||||
describe("citing using an array in different formats", () => {
|
||||
test("citing empty array with APA format", () => {
|
||||
jspsych.getCitations([], "apa");
|
||||
expect(consoleWarnSpy.mock.calls[0][0]).toBe("No plugins/extensions provided");
|
||||
expect(jspsych.getCitations([], "apa")).toBe(jsPsychApaCitation);
|
||||
});
|
||||
test("citing empty array with BibTeX format", () => {
|
||||
jspsych.getCitations([], "bibtex");
|
||||
expect(consoleWarnSpy.mock.calls[0][0]).toBe("No plugins/extensions provided");
|
||||
expect(jspsych.getCitations([], "bibtex")).toBe(jsPsychBibtexCitation);
|
||||
});
|
||||
test("citing empty array without format", () => {
|
||||
jspsych.getCitations([]);
|
||||
expect(consoleWarnSpy.mock.calls[0][0]).toBe("No plugins/extensions provided");
|
||||
expect(jspsych.getCitations([])).toBe(jsPsychApaCitation);
|
||||
});
|
||||
test("citing one plugin with valid format in all caps", () => {
|
||||
jspsych.getCitations([TestPlugin], "APA");
|
||||
expect(consoleLogSpy.mock.calls[0][0]).toBe(testPluginApaCitation);
|
||||
expect(jspsych.getCitations([TestPlugin], "APA")).toBe(
|
||||
jsPsychApaCitation + "\n" + testPluginApaCitation
|
||||
);
|
||||
});
|
||||
test("citing with unsupported format", () => {
|
||||
expect(() => jspsych.getCitations([TestPlugin], "DummyTex")).toThrow(
|
||||
@ -73,24 +73,24 @@ try {
|
||||
|
||||
describe("citing mix of valid plugins/extensions", () => {
|
||||
test("citing a plugin", () => {
|
||||
jspsych.getCitations([TestPlugin]);
|
||||
expect(consoleLogSpy.mock.calls[0][0]).toBe(testPluginApaCitation);
|
||||
expect(jspsych.getCitations([TestPlugin])).toBe(
|
||||
jsPsychApaCitation + "\n" + testPluginApaCitation
|
||||
);
|
||||
});
|
||||
test("citing a plugin in BibTeX", () => {
|
||||
jspsych.getCitations([TestPlugin], "bibtex");
|
||||
expect(consoleLogSpy.mock.calls[0][0]).toBe(testPluginBibtexCitation);
|
||||
expect(jspsych.getCitations([TestPlugin], "bibtex")).toBe(
|
||||
jsPsychBibtexCitation + "\n" + testPluginBibtexCitation
|
||||
);
|
||||
});
|
||||
test("citing multiple plugins", () => {
|
||||
jspsych.getCitations([TestPlugin, TestPlugin]);
|
||||
expect(consoleLogSpy.mock.calls).toHaveLength(2);
|
||||
expect(consoleLogSpy.mock.calls[0][0]).toBe(testPluginApaCitation);
|
||||
expect(consoleLogSpy.mock.calls[1][0]).toBe(testPluginApaCitation);
|
||||
expect(jspsych.getCitations([TestPlugin, TestPlugin])).toBe(
|
||||
jsPsychApaCitation + "\n" + testPluginApaCitation
|
||||
);
|
||||
});
|
||||
test("citing mix of plugins and extensions", () => {
|
||||
jspsych.getCitations([TestPlugin, TestExtension]);
|
||||
expect(consoleLogSpy.mock.calls).toHaveLength(2);
|
||||
expect(consoleLogSpy.mock.calls[0][0]).toBe(testPluginApaCitation);
|
||||
expect(consoleLogSpy.mock.calls[1][0]).toBe(testExtensionApaCitation);
|
||||
expect(jspsych.getCitations([TestPlugin, TestExtension])).toBe(
|
||||
jsPsychApaCitation + "\n" + testPluginApaCitation + "\n" + testExtensionApaCitation
|
||||
);
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
|
Loading…
Reference in New Issue
Block a user