Replace faker for chance
This commit is contained in:
parent
82f697a495
commit
c7d0a077be
|
@ -57,7 +57,6 @@
|
|||
"zlib": "1.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@faker-js/faker": "^7.6.0",
|
||||
"@swc/core": "^1.3.25",
|
||||
"@swc/jest": "^0.2.24",
|
||||
"@trendyol/jest-testcontainers": "^2.1.1",
|
||||
|
@ -89,4 +88,4 @@
|
|||
"typescript": "4.7.3"
|
||||
},
|
||||
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
require("../../../tests")
|
||||
const{generator}=require("../../../tests")
|
||||
const { Writethrough } = require("../writethrough")
|
||||
const { getDB } = require("../../db")
|
||||
const tk = require("timekeeper")
|
||||
|
@ -6,12 +6,12 @@ const tk = require("timekeeper")
|
|||
const START_DATE = Date.now()
|
||||
tk.freeze(START_DATE)
|
||||
|
||||
const { faker } = require( "@faker-js/faker")
|
||||
const { newid } = require("../../newid")
|
||||
|
||||
const DELAY = 5000
|
||||
|
||||
const db = getDB(faker.random.alpha(10))
|
||||
const db2 = getDB(faker.random.alpha(10))
|
||||
const db = getDB(`db_${newid()}`)
|
||||
const db2 = getDB(`db_${newid()}`)
|
||||
const writethrough = new Writethrough(db, DELAY), writethrough2 = new Writethrough(db2, DELAY)
|
||||
|
||||
describe("writethrough", () => {
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
require("../../../tests")
|
||||
const { newid } = require("../../newid")
|
||||
const { getDB } = require("../db")
|
||||
const { faker } = require( "@faker-js/faker")
|
||||
|
||||
describe("db", () => {
|
||||
describe("getDB", () => {
|
||||
it("returns a db", async () => {
|
||||
const dbName = faker.random.alpha(10)
|
||||
|
||||
const dbName = `db_${newid()}`
|
||||
const db = getDB(dbName)
|
||||
expect(db).toBeDefined()
|
||||
expect(db.name).toBe(dbName)
|
||||
})
|
||||
|
||||
it("uses the custom put function", async () => {
|
||||
const db = getDB(faker.random.alpha(10))
|
||||
const db = getDB(`db_${newid()}`)
|
||||
let doc = { _id: "test" }
|
||||
await db.put(doc)
|
||||
doc = await db.get(doc._id)
|
||||
|
|
|
@ -487,6 +487,11 @@
|
|||
qs "^6.11.0"
|
||||
tough-cookie "^4.1.2"
|
||||
|
||||
"@budibase/types@2.2.12-alpha.59":
|
||||
version "2.2.12-alpha.59"
|
||||
resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.12-alpha.59.tgz#41635c1e405acfa6162b5ca0f79f0c73f16bc764"
|
||||
integrity sha512-cEcM0nnTEOEan9UYVspwcdgYgIbtY2zQTe1uDdwys+NFplMrbiwGyQbsafOx2IA0jCxmyqqYGmUAC0eF1napKQ==
|
||||
|
||||
"@cspotcode/source-map-support@^0.8.0":
|
||||
version "0.8.1"
|
||||
resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1"
|
||||
|
@ -494,11 +499,6 @@
|
|||
dependencies:
|
||||
"@jridgewell/trace-mapping" "0.3.9"
|
||||
|
||||
"@faker-js/faker@^7.6.0":
|
||||
version "7.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-7.6.0.tgz#9ea331766084288634a9247fcd8b84f16ff4ba07"
|
||||
integrity sha512-XK6BTq1NDMo9Xqw/YkYyGjSsg44fbNwYRx7QK2CuoQgyy+f1rrTDHoExVM5PsyXCtfl2vs2vVJ0MN0yN6LppRw==
|
||||
|
||||
"@hapi/hoek@^9.0.0":
|
||||
version "9.3.0"
|
||||
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb"
|
||||
|
|
|
@ -122,7 +122,6 @@
|
|||
"@babel/core": "7.17.4",
|
||||
"@babel/preset-env": "7.16.11",
|
||||
"@budibase/standard-components": "^0.9.139",
|
||||
"@faker-js/faker": "^7.6.0",
|
||||
"@jest/test-sequencer": "24.9.0",
|
||||
"@swc/core": "^1.3.25",
|
||||
"@swc/jest": "^0.2.24",
|
||||
|
@ -173,4 +172,4 @@
|
|||
"oracledb": "5.3.0"
|
||||
},
|
||||
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
import { faker } from "@faker-js/faker"
|
||||
import { mocks } from "@budibase/backend-core/tests"
|
||||
import { generator, mocks } from "@budibase/backend-core/tests"
|
||||
|
||||
// init the licensing mock
|
||||
import * as pro from "@budibase/pro"
|
||||
|
@ -89,11 +88,11 @@ class TestConfiguration {
|
|||
|
||||
populateDefaultUserValues(): DefaultUserValues {
|
||||
return {
|
||||
globalUserId: `us_${faker.datatype.uuid()}`,
|
||||
email: faker.internet.email(),
|
||||
firstName: faker.name.firstName(),
|
||||
lastName: faker.name.lastName(),
|
||||
csrfToken: faker.datatype.uuid(),
|
||||
globalUserId: `us_${newid()}`,
|
||||
email: generator.email(),
|
||||
firstName: generator.first(),
|
||||
lastName: generator.last(),
|
||||
csrfToken: generator.hash(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1528,11 +1528,6 @@
|
|||
pump "^3.0.0"
|
||||
secure-json-parse "^2.1.0"
|
||||
|
||||
"@faker-js/faker@^7.6.0":
|
||||
version "7.6.0"
|
||||
resolved "https://registry.yarnpkg.com/@faker-js/faker/-/faker-7.6.0.tgz#9ea331766084288634a9247fcd8b84f16ff4ba07"
|
||||
integrity sha512-XK6BTq1NDMo9Xqw/YkYyGjSsg44fbNwYRx7QK2CuoQgyy+f1rrTDHoExVM5PsyXCtfl2vs2vVJ0MN0yN6LppRw==
|
||||
|
||||
"@google-cloud/firestore@5.0.2":
|
||||
version "5.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@google-cloud/firestore/-/firestore-5.0.2.tgz#36923fde45987f928a220d347f341c5602f9e340"
|
||||
|
|
Loading…
Reference in New Issue