Fix up tests.

This commit is contained in:
Sam Rose 2024-03-22 15:01:40 +00:00
parent 5e6a9d2176
commit a9aa409d7c
No known key found for this signature in database
8 changed files with 12 additions and 18 deletions

View File

@ -42,12 +42,6 @@ if (fs.existsSync("../pro/src")) {
const config: Config.InitialOptions = {
projects: [
{
...baseConfig,
displayName: "sequential test",
testMatch: ["<rootDir>/**/*.seq.spec.[jt]s"],
runner: "jest-serial-runner",
},
{
...baseConfig,
testMatch: ["<rootDir>/**/!(*.seq).spec.[jt]s"],

View File

@ -143,7 +143,6 @@
"jest": "29.7.0",
"jest-openapi": "0.14.2",
"jest-runner": "29.7.0",
"jest-serial-runner": "1.2.1",
"nock": "^13.5.4",
"nodemon": "2.0.15",
"openapi-typescript": "5.2.0",

View File

@ -13,8 +13,6 @@ import mssql from "mssql"
import { Expectations } from "src/tests/utilities/api/base"
import { events } from "@budibase/backend-core"
jest.unmock("pg")
const createTableSQL: Record<string, string> = {
[SourceName.POSTGRES]: `
CREATE TABLE test_table (

View File

@ -30,7 +30,6 @@ const timestamp = new Date("2023-01-26T11:48:57.597Z").toISOString()
tk.freeze(timestamp)
jest.unmock("mssql")
jest.unmock("pg")
describe.each([
["internal", undefined],

View File

@ -26,7 +26,6 @@ import { quotas } from "@budibase/pro"
import { roles } from "@budibase/backend-core"
jest.unmock("mssql")
jest.unmock("pg")
describe.each([
["internal", undefined],

View File

@ -23,7 +23,6 @@ fetch.mockSearch()
const config = setup.getConfig()!
jest.unmock("pg")
jest.mock("../websockets")
describe("postgres integrations", () => {

View File

@ -1,5 +1,3 @@
jest.unmock("pg")
import { Datasource } from "@budibase/types"
import * as postgres from "./postgres"
import * as mongodb from "./mongodb"

View File

@ -35,11 +35,20 @@ describe("syncGlobalUsers", () => {
builder: { global: true },
})
await config.doInContext(config.appId, async () => {
expect(await rawUserMetadata()).toHaveLength(1)
let metadata = await rawUserMetadata()
expect(metadata).not.toContainEqual(
expect.objectContaining({
_id: db.generateUserMetadataID(user1._id!),
})
)
expect(metadata).not.toContainEqual(
expect.objectContaining({
_id: db.generateUserMetadataID(user2._id!),
})
)
await syncGlobalUsers()
const metadata = await rawUserMetadata()
expect(metadata).toHaveLength(3)
metadata = await rawUserMetadata()
expect(metadata).toContainEqual(
expect.objectContaining({
_id: db.generateUserMetadataID(user1._id!),
@ -62,7 +71,6 @@ describe("syncGlobalUsers", () => {
await syncGlobalUsers()
const metadata = await rawUserMetadata()
expect(metadata).toHaveLength(1)
expect(metadata).not.toContainEqual(
expect.objectContaining({
_id: db.generateUserMetadataID(user._id!),