Remove remaning faker refs

This commit is contained in:
adrinr 2023-02-01 17:19:56 +00:00
parent c7d0a077be
commit 79ee85dab3
3 changed files with 9 additions and 10 deletions

View File

@ -8,7 +8,7 @@ const {
const { generateAppID, getPlatformUrl, getScopedConfig } = require("../utils")
const tenancy = require("../../tenancy")
const { Config, DEFAULT_TENANT_ID } = require("../../constants")
import { faker } from "@faker-js/faker"
import { generator } from "../../../tests"
import env from "../../environment"
describe("utils", () => {
@ -119,7 +119,7 @@ describe("getPlatformUrl", () => {
it("gets the platform url from the database", async () => {
await tenancy.doInTenant(null, async () => {
const dbUrl = faker.internet.url()
const dbUrl = generator.url()
await setDbPlatformUrl(dbUrl)
const url = await getPlatformUrl()
expect(url).toBe(dbUrl)
@ -153,7 +153,7 @@ describe("getPlatformUrl", () => {
it("never gets the platform url from the database", async () => {
await tenancy.doInTenant(DEFAULT_TENANT_ID, async () => {
await setDbPlatformUrl(faker.internet.url())
await setDbPlatformUrl(generator.url())
const url = await getPlatformUrl()
expect(url).toBe(TENANT_AWARE_URL)
})
@ -171,7 +171,7 @@ describe("getScopedConfig", () => {
it("returns the platform url with an existing config", async () => {
await tenancy.doInTenant(DEFAULT_TENANT_ID, async () => {
const dbUrl = faker.internet.url()
const dbUrl = generator.url()
await setDbPlatformUrl(dbUrl)
const db = tenancy.getGlobalDB()
const config = await getScopedConfig(db, { type: Config.SETTINGS })

View File

@ -2,9 +2,8 @@ require("../../../tests")
const { runMigrations, getMigrationsDoc } = require("../index")
const { getGlobalDBName, getDB } = require("../../db")
const { faker } = require( "@faker-js/faker")
const { default: environment } = require("../../environment")
const { newid } = require("../../newid")
environment._set("MULTI_TENANCY", 'TRUE')
let db
@ -22,7 +21,7 @@ describe("migrations", () => {
let tenantId
beforeEach(() => {
tenantId =faker.random.alpha(10)
tenantId = `tenant_${newid()}`
db = getDB(getGlobalDBName(tenantId))
})

View File

@ -4,8 +4,8 @@ import * as events from "../../events"
import * as db from "../../db"
import { Header } from "../../constants"
import { doInTenant } from "../../context"
import { faker } from "@faker-js/faker"
import environment from "../../environment"
import { newid } from "../../utils"
describe("utils", () => {
describe("platformLogout", () => {
@ -14,7 +14,7 @@ describe("utils", () => {
})
it("should call platform logout", async () => {
await doInTenant(faker.random.alpha(10), async () => {
await doInTenant(`tenant-${newid()}`, async () => {
const ctx = structures.koa.newContext()
await utils.platformLogout({ ctx, userId: "test" })
expect(events.auth.logout).toBeCalledTimes(1)
@ -64,7 +64,7 @@ describe("utils", () => {
const app = structures.apps.app(expected)
// set custom url
const appUrl = faker.datatype.uuid()
const appUrl = newid()
app.url = `/${appUrl}`
ctx.path = `/app/${appUrl}`