Check sanity more closely
Test / test (push) Failing after 1m49s
Details
Test / test (push) Failing after 1m49s
Details
This commit is contained in:
parent
cfd6a40859
commit
d2860dc454
|
|
@ -34,71 +34,76 @@ jest.mock("./settings", () => ({
|
|||
}))
|
||||
|
||||
describe("subscriptions", () => {
|
||||
beforeAll(async () => {
|
||||
console.log("HEY WTF MAN")
|
||||
await resetDbInstance()
|
||||
test("Does it run", () => {
|
||||
console.log("WHOAH")
|
||||
expect(true).toBeTruthy()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
await migrateToLatest()
|
||||
})
|
||||
// beforeAll(async () => {
|
||||
// console.log("HEY WTF MAN")
|
||||
// await resetDbInstance()
|
||||
// })
|
||||
|
||||
afterEach(async () => {
|
||||
await resetAll()
|
||||
})
|
||||
// beforeEach(async () => {
|
||||
// await migrateToLatest()
|
||||
// })
|
||||
|
||||
afterAll(async () => {
|
||||
await db.destroy()
|
||||
})
|
||||
// afterEach(async () => {
|
||||
// await resetAll()
|
||||
// })
|
||||
|
||||
test("createSubscription", async () => {
|
||||
const { id } = await createSubscription(pushSubscription1)
|
||||
// afterAll(async () => {
|
||||
// await db.destroy()
|
||||
// })
|
||||
|
||||
const subscription = (await db
|
||||
.selectFrom("subscription")
|
||||
.selectAll()
|
||||
.where("id", "=", id)
|
||||
.executeTakeFirst()) as Subscription
|
||||
// test("createSubscription", async () => {
|
||||
// const { id } = await createSubscription(pushSubscription1)
|
||||
|
||||
expect(subscription).toEqual({
|
||||
id,
|
||||
subscription: pushSubscription1,
|
||||
})
|
||||
})
|
||||
// const subscription = (await db
|
||||
// .selectFrom("subscription")
|
||||
// .selectAll()
|
||||
// .where("id", "=", id)
|
||||
// .executeTakeFirst()) as Subscription
|
||||
|
||||
test("updateSubscription", async () => {
|
||||
const { id } = (await db
|
||||
.insertInto("subscription")
|
||||
.values({ subscription: JSON.stringify(pushSubscription1), id: 50 })
|
||||
.returning("id")
|
||||
.executeTakeFirst())!
|
||||
// expect(subscription).toEqual({
|
||||
// id,
|
||||
// subscription: pushSubscription1,
|
||||
// })
|
||||
// })
|
||||
|
||||
await updateSubscription(pushSubscription2, id)
|
||||
// test("updateSubscription", async () => {
|
||||
// const { id } = (await db
|
||||
// .insertInto("subscription")
|
||||
// .values({ subscription: JSON.stringify(pushSubscription1), id: 50 })
|
||||
// .returning("id")
|
||||
// .executeTakeFirst())!
|
||||
|
||||
const updated = (await db
|
||||
.selectFrom("subscription")
|
||||
.selectAll()
|
||||
.where("id", "=", id)
|
||||
.executeTakeFirst()) as Subscription
|
||||
// await updateSubscription(pushSubscription2, id)
|
||||
|
||||
expect(updated).toEqual({
|
||||
id,
|
||||
subscription: pushSubscription2,
|
||||
})
|
||||
})
|
||||
// const updated = (await db
|
||||
// .selectFrom("subscription")
|
||||
// .selectAll()
|
||||
// .where("id", "=", id)
|
||||
// .executeTakeFirst()) as Subscription
|
||||
|
||||
test("getSubscription", async () => {
|
||||
const { id } = (await db
|
||||
.insertInto("subscription")
|
||||
.values({ subscription: JSON.stringify(pushSubscription1), id: 5000 })
|
||||
.returning("id")
|
||||
.executeTakeFirst())!
|
||||
// expect(updated).toEqual({
|
||||
// id,
|
||||
// subscription: pushSubscription2,
|
||||
// })
|
||||
// })
|
||||
|
||||
const got = await getSubscription(id)
|
||||
// test("getSubscription", async () => {
|
||||
// const { id } = (await db
|
||||
// .insertInto("subscription")
|
||||
// .values({ subscription: JSON.stringify(pushSubscription1), id: 5000 })
|
||||
// .returning("id")
|
||||
// .executeTakeFirst())!
|
||||
|
||||
expect(got).toEqual({
|
||||
subscription: pushSubscription1,
|
||||
id: 5000,
|
||||
})
|
||||
})
|
||||
// const got = await getSubscription(id)
|
||||
|
||||
// expect(got).toEqual({
|
||||
// subscription: pushSubscription1,
|
||||
// id: 5000,
|
||||
// })
|
||||
// })
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue