Fixed test to use plugin_version

This commit is contained in:
vzhang03 2024-06-25 12:56:27 -04:00
parent 1542c219d3
commit bdf4fc3eee
3 changed files with 11 additions and 7 deletions

View File

@ -20,7 +20,9 @@ describe("data conversion to csv", () => {
await clickTarget(document.querySelector("#jspsych-survey-text-next"));
expect(
getData().ignore(["rt", "internal_node_id", "time_elapsed", "trial_type", "version"]).csv()
getData()
.ignore(["rt", "internal_node_id", "time_elapsed", "trial_type", "plugin_version"])
.csv()
).toBe('"response","trial_index"\r\n"{""Q0"":""Response 1"",""Q1"":""Response 2""}","0"\r\n');
});
@ -51,7 +53,7 @@ describe("data conversion to csv", () => {
"trial_type",
"rt_stim1",
"response_stim1",
"version",
"plugin_version",
])
.csv()
).toBe(
@ -81,7 +83,7 @@ describe("data conversion to csv", () => {
"time_elapsed",
"trial_type",
"question_order",
"version",
"plugin_version",
])
.csv()
).toBe('"response","trial_index"\r\n"{""q"":[""fuzz"",""bizz""]}","0"\r\n');

View File

@ -21,7 +21,9 @@ describe("data conversion to json", () => {
await clickTarget(document.querySelector("#jspsych-survey-text-next"));
expect(
getData().ignore(["rt", "internal_node_id", "time_elapsed", "trial_type", "version"]).json()
getData()
.ignore(["rt", "internal_node_id", "time_elapsed", "trial_type", "plugin_version"])
.json()
).toBe(JSON.stringify([{ response: { Q0: "Response 1", Q1: "Response 2" }, trial_index: 0 }]));
});
@ -52,7 +54,7 @@ describe("data conversion to json", () => {
"trial_type",
"rt_stim1",
"response_stim1",
"version",
"plugin_version",
])
.json()
).toBe(
@ -90,7 +92,7 @@ describe("data conversion to json", () => {
"time_elapsed",
"trial_type",
"question_order",
"version",
"plugin_version",
])
.json()
).toBe(

View File

@ -131,7 +131,7 @@ describe("#displayData", () => {
jsPsych.data.displayData("csv");
// check display element HTML
expect(getHTML()).toMatch(
/<pre id="jspsych-data-display">"rt","stimulus","response","trial_type","trial_index","version","time_elapsed"\r\n"[\d]+","hello","a","html-keyboard-response","0","[\d.]+","[\d]+"\r\n<\/pre>/
/<pre id="jspsych-data-display">"rt","stimulus","response","trial_type","trial_index","plugin_version","time_elapsed"\r\n"[\d]+","hello","a","html-keyboard-response","0","[\d.]+","[\d]+"\r\n<\/pre>/
);
});
});