Skip to content
Snippets Groups Projects
Commit fb946115 authored by Tom Robinson's avatar Tom Robinson
Browse files

Change forBothAdminsAndNormalUsers

parent c53e1837
No related branches found
No related tags found
No related merge requests found
......@@ -98,11 +98,15 @@ export function useSharedNormalLogin() {
id: process.env.TEST_FIXTURE_SHARED_NORMAL_LOGIN_SESSION_ID,
};
}
export const forBothAdminsAndNormalUsers = async tests => {
useSharedAdminLogin();
await tests();
useSharedNormalLogin();
await tests();
export const forBothAdminsAndNormalUsers = tests => {
describe("for admins", () => {
beforeEach(useSharedAdminLogin);
tests();
});
describe("for normal users", () => {
beforeEach(useSharedNormalLogin);
tests();
});
};
export function logout() {
......
......@@ -188,8 +188,8 @@ describe("Alerts", () => {
});
describe("missing email/slack credentials", () => {
it("should prompt you to add email/slack credentials", async () => {
await forBothAdminsAndNormalUsers(async () => {
forBothAdminsAndNormalUsers(() => {
it("should prompt you to add email/slack credentials", async () => {
MetabaseCookies.getHasSeenAlertSplash = () => false;
const store = await createTestStore();
......
......@@ -86,8 +86,8 @@ describe("new question flow", async () => {
expect(store.getPath()).toBe("/question/new");
});
it("renders all options for both admins and normal users if metrics & segments exist", async () => {
await forBothAdminsAndNormalUsers(async () => {
forBothAdminsAndNormalUsers(() => {
it("renders all options for both admins and normal users if metrics & segments exist", async () => {
const store = await createTestStore();
store.pushPath(Urls.newQuestion());
......@@ -181,8 +181,8 @@ describe("new question flow", async () => {
);
});
it("shows an empty state if there are no databases", async () => {
await forBothAdminsAndNormalUsers(async () => {
forBothAdminsAndNormalUsers(() => {
it("shows an empty state if there are no databases", async () => {
await withApiMocks([[Databases.api, "list", () => []]], async () => {
const store = await createTestStore();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment