1
0
Fork 0
mirror of synced 2024-07-06 15:00:49 +12:00

Check types on backend-core

This commit is contained in:
Adria Navarro 2023-08-01 13:08:09 +02:00
parent ff7120cf7a
commit 8b693a6fa3
3 changed files with 8 additions and 8 deletions

View file

@ -16,6 +16,7 @@
"prepack": "cp package.json dist",
"build": "tsc -p tsconfig.build.json",
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
"check:types": "tsc -p tsconfig.json --noEmit --paths null",
"test": "bash scripts/test.sh",
"test:watch": "jest --watchAll"
},

View file

@ -36,7 +36,7 @@ describe("writethrough", () => {
_id: docId,
value: 1,
})
const output = await db.get(response.id)
const output = await db.get<any>(response.id)
current = output
expect(output.value).toBe(1)
})
@ -45,7 +45,7 @@ describe("writethrough", () => {
it("second put shouldn't update DB", async () => {
await config.doInTenant(async () => {
const response = await writethrough.put({ ...current, value: 2 })
const output = await db.get(response.id)
const output = await db.get<any>(response.id)
expect(current._rev).toBe(output._rev)
expect(output.value).toBe(1)
})
@ -55,7 +55,7 @@ describe("writethrough", () => {
await config.doInTenant(async () => {
tk.freeze(Date.now() + DELAY + 1)
const response = await writethrough.put({ ...current, value: 3 })
const output = await db.get(response.id)
const output = await db.get<any>(response.id)
expect(response.rev).not.toBe(current._rev)
expect(output.value).toBe(3)
@ -79,7 +79,7 @@ describe("writethrough", () => {
expect.arrayContaining([current._rev, current._rev, newRev])
)
const output = await db.get(current._id)
const output = await db.get<any>(current._id)
expect(output.value).toBe(4)
expect(output._rev).toBe(newRev)
@ -107,7 +107,7 @@ describe("writethrough", () => {
})
expect(res.ok).toBe(true)
const output = await db.get(id)
const output = await db.get<any>(id)
expect(output.value).toBe(3)
expect(output._rev).toBe(res.rev)
})
@ -130,8 +130,8 @@ describe("writethrough", () => {
const resp2 = await writethrough2.put({ _id: "db1", value: "second" })
expect(resp1.rev).toBeDefined()
expect(resp2.rev).toBeDefined()
expect((await db.get("db1")).value).toBe("first")
expect((await db2.get("db1")).value).toBe("second")
expect((await db.get<any>("db1")).value).toBe("first")
expect((await db2.get<any>("db1")).value).toBe("second")
})
})
})

View file

@ -7,6 +7,5 @@
"@budibase/types": ["../types/src"]
}
},
"exclude": ["node_modules", "dist"]
}