feat: create route to store FCM token

This commit is contained in:
2024-06-14 18:14:10 -04:00
parent 4d3c34579d
commit 231ed4bde4
16 changed files with 650 additions and 14 deletions

View File

@@ -3,10 +3,9 @@ import { beforeEach, describe, expect, it } from "bun:test";
import app from "~/index";
import { server } from "~/mocks";
import { getDb, resetDb } from "~/models/db";
import { tokenTable } from "~/models/schema";
import { deviceTokensTable } from "~/models/schema";
server.listen();
console.error = () => {};
describe("requests the /watch-status route", () => {
const db = getDb({
@@ -19,7 +18,9 @@ describe("requests the /watch-status route", () => {
});
it("saving title, deviceId in db, should succeed", async () => {
await db.insert(tokenTable).values({ deviceId: "123", token: "asd" });
await db
.insert(deviceTokensTable)
.values({ deviceId: "123", token: "asd" });
const res = await app.request(
"/watch-status",
@@ -71,7 +72,9 @@ describe("requests the /watch-status route", () => {
});
it("saving title, Anilist request fails, should succeed", async () => {
await db.insert(tokenTable).values({ deviceId: "123", token: "asd" });
await db
.insert(deviceTokensTable)
.values({ deviceId: "123", token: "asd" });
const res = await app.request(
"/watch-status",