diff --git a/packages/record/src/consentVideo.spec.ts b/packages/record/src/consentVideo.spec.ts index 630846c3..add1ba7c 100644 --- a/packages/record/src/consentVideo.spec.ts +++ b/packages/record/src/consentVideo.spec.ts @@ -272,3 +272,7 @@ test("nextButton", () => { expect(jsPsych.finishTrial).toHaveBeenCalledTimes(1); }); + +test("Does video consent plugin return chsData correctly?", () => { + expect(VideoConsentPlugin.chsData()).toMatchObject({ chs_type: "consent" }); +}); diff --git a/packages/record/src/consentVideo.ts b/packages/record/src/consentVideo.ts index 0bea6140..0fbbb85c 100644 --- a/packages/record/src/consentVideo.ts +++ b/packages/record/src/consentVideo.ts @@ -281,4 +281,15 @@ export class VideoConsentPlugin implements JsPsychPlugin { const next = this.getButton(display, "next"); next.addEventListener("click", () => this.jsPsych.finishTrial()); } + + /** + * Add CHS type to experiment data. This will enable Lookit API to run the + * "consent" Frame Action Dispatcher method after the experiment has + * completed. It looks like jsPsych uses snake case for these data. + * + * @returns Object containing CHS type. + */ + public static chsData() { + return { chs_type: "consent" }; + } }