Skip to content

Commit

Permalink
test: 'setDefaults' fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-gilin committed Nov 24, 2022
1 parent de8550e commit f35cfc0
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions packages/backend/test/yeomanui.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -808,19 +808,22 @@ describe("yeomanui unit test", () => {
};
ReplayUtils["setDefaults"](questions, answers);
for (const question of questions) {
switch (question.name) {
case "a":
expect((question as any)["answer"]).to.equal("x");
break;
case "b":
expect((question as any)["answer"]).to.equal("y");
break;
case "c":
expect((question as any)["answer"]).to.equal("z");
break;
}
expect((question as any)["__origAnswer"]).to.equal((<any>answers)[question.name]);
expect((question as any)["__ForceDefault"]).to.be.true;
}
});

it("setDefaults", () => {
const questions = [{ name: "q1", default: "a" }, { name: "q2", default: () => "b" }, { name: "q3" }];
const answers = {
q1: "x",
q3: "z",
};
ReplayUtils["setDefaults"](questions, answers);
const question = _.find(questions, { name: "q2" });
expect((question as any).__origAnswer).to.be.undefined;
expect((question as any).__ForceDefault).to.be.undefined;
});
});

it("handleErrors", () => {
Expand Down

0 comments on commit f35cfc0

Please sign in to comment.