Changeset View
Changeset View
Standalone View
Standalone View
lib/app/base-chips/collections/users.subtest.js
const locreq = require("locreq")(__dirname); | const locreq = require("locreq")(__dirname); | ||||
const assert = require("assert"); | const assert = require("assert"); | ||||
const { with_running_app } = locreq("test_utils/with-test-app.js"); | const { with_running_app } = locreq("test_utils/with-test-app.js"); | ||||
const assert_throws_async = locreq("test_utils/assert_throws_async.js"); | const assert_throws_async = locreq("test_utils/assert_throws_async.js"); | ||||
describe("users", () => { | describe("users", () => { | ||||
describe("auto create admin", () => { | describe("auto create admin", () => { | ||||
it("should automatically create a registration intent for the admin user", async () => | it("should automatically create a registration intent for the admin user", async () => | ||||
with_running_app(async ({ app }) => { | with_running_app(async ({ app }) => { | ||||
const { items: registration_intents } = await app.run_action( | const { items: registration_intents } = await app.run_action( | ||||
new app.Sealious.SuperContext(), | new app.Sealious.SuperContext(), | ||||
["collections", "registration-intents"], | ["collections", "registration-intents"], | ||||
"show", | "show", | ||||
{ filter: { email: app.manifest.admin_email } } | { filter: { email: app.manifest.admin_email } } | ||||
); | ); | ||||
assert.equal(registration_intents.length, 1); | assert.equal(registration_intents.length, 1); | ||||
assert.equal(registration_intents[0].body.role, "admin"); | assert.equal(registration_intents[0].role, "admin"); | ||||
})); | })); | ||||
it("should properly handle route to account cration", async () => | it("should properly handle route to account cration", async () => | ||||
with_running_app(async ({ app, rest_api }) => { | with_running_app(async ({ app, rest_api }) => { | ||||
const { | const { | ||||
items: [registration_intent], | items: [registration_intent], | ||||
} = await app.run_action( | } = await app.run_action( | ||||
new app.Sealious.SuperContext(), | new app.Sealious.SuperContext(), | ||||
["collections", "registration-intents"], | ["collections", "registration-intents"], | ||||
"show", | "show", | ||||
{ filter: { email: app.manifest.admin_email } } | { filter: { email: app.manifest.admin_email } } | ||||
); | ); | ||||
const { email, token } = registration_intent.body; | const { email, token } = registration_intent; | ||||
const response = await rest_api.get( | const response = await rest_api.get( | ||||
`/account-creation-details?token=${token}&email=${email}` | `/account-creation-details?token=${token}&email=${email}` | ||||
); | ); | ||||
assert(response.includes("Uzupełnij dane o Twoim koncie")); | assert(response.includes("Uzupełnij dane o Twoim koncie")); | ||||
})); | })); | ||||
}); | }); | ||||
describe("users routes", () => { | describe("users routes", () => { | ||||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |