Fix local test port
Test / test (push) Successful in 59s
Details
Test / test (push) Successful in 59s
Details
This commit is contained in:
parent
be55d46391
commit
a719706dff
|
|
@ -7,8 +7,6 @@ import {
|
||||||
updateSubscription,
|
updateSubscription,
|
||||||
} from "./subscription"
|
} from "./subscription"
|
||||||
|
|
||||||
import { exec } from "child_process"
|
|
||||||
|
|
||||||
const pushSubscription1 = {
|
const pushSubscription1 = {
|
||||||
endpoint: "https://updates.push.services.mozilla.com/wpush/v2/aaaaaaa",
|
endpoint: "https://updates.push.services.mozilla.com/wpush/v2/aaaaaaa",
|
||||||
expirationTime: null,
|
expirationTime: null,
|
||||||
|
|
@ -28,96 +26,78 @@ const pushSubscription2 = {
|
||||||
}
|
}
|
||||||
|
|
||||||
jest.mock("./settings", () => ({
|
jest.mock("./settings", () => ({
|
||||||
port: 5432,
|
port: process.env.POSTGRES_PORT,
|
||||||
user: "postgres",
|
user: "postgres",
|
||||||
password: process.env.POSTGRES_PASSWORD,
|
password: process.env.POSTGRES_PASSWORD,
|
||||||
database: "test",
|
database: "test",
|
||||||
host: process.env.POSTGRES_HOST ?? "localhost",
|
host: process.env.POSTGRES_HOST,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
describe("subscriptions", () => {
|
describe("subscriptions", () => {
|
||||||
test("Does it run", () => {
|
|
||||||
console.log("WHOAH")
|
|
||||||
expect(true).toBeTruthy()
|
|
||||||
})
|
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
console.log("HEY WTF MAN")
|
|
||||||
try {
|
|
||||||
await resetDbInstance()
|
await resetDbInstance()
|
||||||
} catch (error) {
|
|
||||||
console.log("Something has exploded")
|
|
||||||
fail(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
try {
|
|
||||||
exec("docker ps", (_, out) => console.log(out))
|
|
||||||
exec("ls /home", (_, out) => console.log(out))
|
|
||||||
await migrateToLatest()
|
await migrateToLatest()
|
||||||
} catch (error) {
|
|
||||||
console.log("Something has exploded in migration")
|
|
||||||
fail(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// afterEach(async () => {
|
afterEach(async () => {
|
||||||
// await resetAll()
|
await resetAll()
|
||||||
// })
|
})
|
||||||
|
|
||||||
// afterAll(async () => {
|
afterAll(async () => {
|
||||||
// await db.destroy()
|
await db.destroy()
|
||||||
// })
|
})
|
||||||
|
|
||||||
// test("createSubscription", async () => {
|
test("createSubscription", async () => {
|
||||||
// const { id } = await createSubscription(pushSubscription1)
|
const { id } = await createSubscription(pushSubscription1)
|
||||||
|
|
||||||
// const subscription = (await db
|
const subscription = (await db
|
||||||
// .selectFrom("subscription")
|
.selectFrom("subscription")
|
||||||
// .selectAll()
|
.selectAll()
|
||||||
// .where("id", "=", id)
|
.where("id", "=", id)
|
||||||
// .executeTakeFirst()) as Subscription
|
.executeTakeFirst()) as Subscription
|
||||||
|
|
||||||
// expect(subscription).toEqual({
|
expect(subscription).toEqual({
|
||||||
// id,
|
id,
|
||||||
// subscription: pushSubscription1,
|
subscription: pushSubscription1,
|
||||||
// })
|
})
|
||||||
// })
|
})
|
||||||
|
|
||||||
// test("updateSubscription", async () => {
|
test("updateSubscription", async () => {
|
||||||
// const { id } = (await db
|
const { id } = (await db
|
||||||
// .insertInto("subscription")
|
.insertInto("subscription")
|
||||||
// .values({ subscription: JSON.stringify(pushSubscription1), id: 50 })
|
.values({ subscription: JSON.stringify(pushSubscription1), id: 50 })
|
||||||
// .returning("id")
|
.returning("id")
|
||||||
// .executeTakeFirst())!
|
.executeTakeFirst())!
|
||||||
|
|
||||||
// await updateSubscription(pushSubscription2, id)
|
await updateSubscription(pushSubscription2, id)
|
||||||
|
|
||||||
// const updated = (await db
|
const updated = (await db
|
||||||
// .selectFrom("subscription")
|
.selectFrom("subscription")
|
||||||
// .selectAll()
|
.selectAll()
|
||||||
// .where("id", "=", id)
|
.where("id", "=", id)
|
||||||
// .executeTakeFirst()) as Subscription
|
.executeTakeFirst()) as Subscription
|
||||||
|
|
||||||
// expect(updated).toEqual({
|
expect(updated).toEqual({
|
||||||
// id,
|
id,
|
||||||
// subscription: pushSubscription2,
|
subscription: pushSubscription2,
|
||||||
// })
|
})
|
||||||
// })
|
})
|
||||||
|
|
||||||
// test("getSubscription", async () => {
|
test("getSubscription", async () => {
|
||||||
// const { id } = (await db
|
const { id } = (await db
|
||||||
// .insertInto("subscription")
|
.insertInto("subscription")
|
||||||
// .values({ subscription: JSON.stringify(pushSubscription1), id: 5000 })
|
.values({ subscription: JSON.stringify(pushSubscription1), id: 5000 })
|
||||||
// .returning("id")
|
.returning("id")
|
||||||
// .executeTakeFirst())!
|
.executeTakeFirst())!
|
||||||
|
|
||||||
// const got = await getSubscription(id)
|
const got = await getSubscription(id)
|
||||||
|
|
||||||
// expect(got).toEqual({
|
expect(got).toEqual({
|
||||||
// subscription: pushSubscription1,
|
subscription: pushSubscription1,
|
||||||
// id: 5000,
|
id: 5000,
|
||||||
// })
|
})
|
||||||
// })
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue