This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
76 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
const multiSurvey = require("../trials/multiSurvey.js"); | ||
|
||
describe("multiSurvey trial", () => { | ||
it(" with same ans choices for all questions", () => { | ||
const preamble = "Answer the below questions"; | ||
const options = { | ||
preamble: preamble, | ||
prompts: ["hello?", "1?", "2?"], | ||
ansChoices: { choices: ["no", "yes"] }, | ||
}; | ||
const questions = [ | ||
{ prompt: "hello?", options: ["no", "yes"], required: true }, | ||
{ prompt: "1?", options: ["no", "yes"], required: true }, | ||
{ prompt: "2?", options: ["no", "yes"], required: true }, | ||
]; | ||
const result = multiSurvey(options); | ||
expect(result.preamble).toContain(preamble); | ||
expect(result.questions).toEqual(questions); | ||
}); | ||
|
||
it(" with different ans choices for each questions", () => { | ||
const preamble = "Answer the below questions"; | ||
const options = { | ||
preamble: preamble, | ||
prompts: ["hello?", "1?", "2?"], | ||
ansChoices: { | ||
1: ["no", "yes", "maybe"], | ||
2: ["not at all", "yes"], | ||
3: ["nope", "yeah"], | ||
}, | ||
}; | ||
const questions = [ | ||
{ prompt: "hello?", options: ["no", "yes", "maybe"], required: true }, | ||
{ prompt: "1?", options: ["not at all", "yes"], required: true }, | ||
{ prompt: "2?", options: ["nope", "yeah"], required: true }, | ||
]; | ||
const result = multiSurvey(options); | ||
expect(result.preamble).toContain(preamble); | ||
expect(result.questions).toEqual(questions); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const survey = require("../trials/survey.js"); | ||
|
||
describe("survey trial", () => { | ||
it("survey with require movement", () => { | ||
const message = "What is your age?"; | ||
const result = survey( | ||
{message:message}); | ||
const data = { | ||
prompt: null, | ||
answer: null, | ||
responses: JSON.stringify({Q0:"response"}), | ||
}; | ||
result.on_finish(data); | ||
expect(result.questions[0].prompt).toContain(message); | ||
expect(data.prompt[0]).toContain(message); | ||
expect(data.answer).toEqual("response"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters