1
0
Fork 0

FIX: direct step path error when not logged in && fix acceptance tests

Dieser Commit ist enthalten in:
Angus McLeod 2022-08-01 08:41:11 +01:00
Ursprung 556a32aa5c
Commit 0d7a220f1d
4 geänderte Dateien mit 14 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -4,7 +4,12 @@ import Route from "@ember/routing/route";
export default Route.extend({
beforeModel() {
this.set("wizard", getCachedWizard());
const wizard = getCachedWizard();
this.set("wizard", wizard);
if (!wizard || !wizard.user || !wizard.permitted || wizard.completed) {
this.replaceWith("customWizard");
}
},
model(params) {

Datei anzeigen

@ -21,6 +21,7 @@ acceptance("Step | Not permitted", function (needs) {
});
acceptance("Step | Step", function (needs) {
needs.user();
needs.pretender((server, helper) => {
server.get("/w/wizard.json", () => helper.response(wizard));
server.put("/w/wizard/steps/:step_id", () => helper.response(update));

Datei anzeigen

@ -18,10 +18,15 @@ acceptance("Wizard | Not logged in", function (needs) {
server.get("/w/wizard.json", () => helper.response(wizardNoUser));
});
test("Wizard no access requires login", async function (assert) {
test("Requires login", async function (assert) {
await visit("/w/wizard");
assert.ok(exists(".wizard-no-access.requires-login"));
});
test("Requires login if a step path is used", async function (assert) {
await visit("/w/wizard/steps/1");
assert.ok(exists(".wizard-no-access.requires-login"));
});
});
acceptance("Wizard | Not permitted", function (needs) {

Datei anzeigen

@ -34,7 +34,7 @@ allFieldsWizard.categories = cloneJSON(categoriesJson["categories"]);
allFieldsWizard.groups = cloneJSON(groupsJson["groups"]);
const update = cloneJSON(updateJson);
update.wizard = cloneJSON(wizardJson);
update.wizard = cloneJSON(wizard);
export {
wizardNoUser,