0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-21 00:01:12 +02:00
discourse-custom-wizard/assets/javascripts/wizard/tests/helpers/wizard.js.es6

53 Zeilen
1,4 KiB
Text

2022-03-16 12:33:34 +01:00
import wizardJson from "../fixtures/wizard";
import userJson from "../fixtures/user";
import categoriesJson from "../fixtures/categories";
import groupsJson from "../fixtures/groups";
import { cloneJSON } from "discourse-common/lib/object";
const wizardNoUser = cloneJSON(wizardJson);
const wizard = cloneJSON(wizardJson);
wizard.user = cloneJSON(userJson);
const wizardNotPermitted = cloneJSON(wizard);
wizardNotPermitted.permitted = false;
const wizardCompleted = cloneJSON(wizard);
wizardCompleted.completed = true;
wizard.start = "step_1";
wizard.resume_on_revisit = false;
wizard.submission_last_updated_at = "2022-03-11T20:00:18+01:00";
wizard.subscribed = false;
const stepNotPermitted = cloneJSON(wizard);
stepNotPermitted.steps[0].permitted = false;
const allFieldsWizard = cloneJSON(wizard);
allFieldsWizard.steps[0].fields = [
...allFieldsWizard.steps[0].fields,
...allFieldsWizard.steps[1].fields,
2022-06-15 08:59:09 +02:00
...allFieldsWizard.steps[2].fields,
2022-03-16 12:33:34 +01:00
];
allFieldsWizard.steps = [cloneJSON(allFieldsWizard.steps[0])];
2022-06-15 08:59:09 +02:00
allFieldsWizard.categories = cloneJSON(categoriesJson["categories"]);
allFieldsWizard.groups = cloneJSON(groupsJson["groups"]);
2022-03-16 12:33:34 +01:00
2022-06-15 08:59:09 +02:00
const getWizard = function (response) {
2022-03-16 12:33:34 +01:00
return {
verb: "get",
path: "/w/wizard",
status: 200,
2022-06-15 08:59:09 +02:00
response,
};
};
2022-03-16 12:33:34 +01:00
export {
getWizard,
wizardNoUser,
wizardNotPermitted,
wizardCompleted,
stepNotPermitted,
allFieldsWizard,
2022-06-15 08:59:09 +02:00
wizard,
};