mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Migrate & test
This commit is contained in:
parent
2cebdcd63e
commit
f6b10738da
1
api/drizzle/0015_news.sql
Normal file
1
api/drizzle/0015_news.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "kyoo"."entries" ADD COLUMN "available_since" timestamp with time zone;
|
1493
api/drizzle/meta/0015_snapshot.json
Normal file
1493
api/drizzle/meta/0015_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -106,6 +106,13 @@
|
|||||||
"when": 1741601145901,
|
"when": 1741601145901,
|
||||||
"tag": "0014_staff",
|
"tag": "0014_staff",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 15,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1741623934941,
|
||||||
|
"tag": "0015_news",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -129,3 +129,28 @@ export const getUnknowns = async (opts: {
|
|||||||
const body = await resp.json();
|
const body = await resp.json();
|
||||||
return [resp, body] as const;
|
return [resp, body] as const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getNews = async ({
|
||||||
|
langs,
|
||||||
|
...opts
|
||||||
|
}: {
|
||||||
|
filter?: string;
|
||||||
|
limit?: number;
|
||||||
|
after?: string;
|
||||||
|
query?: string;
|
||||||
|
langs?: string;
|
||||||
|
preferOriginal?: boolean;
|
||||||
|
}) => {
|
||||||
|
const resp = await app.handle(
|
||||||
|
new Request(buildUrl("news", opts), {
|
||||||
|
method: "GET",
|
||||||
|
headers: langs
|
||||||
|
? {
|
||||||
|
"Accept-Language": langs,
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
const body = await resp.json();
|
||||||
|
return [resp, body] as const;
|
||||||
|
};
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
import { beforeAll, describe, expect, it } from "bun:test";
|
import { beforeAll, describe, expect, it } from "bun:test";
|
||||||
import { createSerie, createVideo, getEntries, getExtras } from "tests/helpers";
|
import {
|
||||||
|
createSerie,
|
||||||
|
createVideo,
|
||||||
|
getEntries,
|
||||||
|
getExtras,
|
||||||
|
getNews,
|
||||||
|
} from "tests/helpers";
|
||||||
import { expectStatus } from "tests/utils";
|
import { expectStatus } from "tests/utils";
|
||||||
import { db } from "~/db";
|
import { db } from "~/db";
|
||||||
import { shows, videos } from "~/db/schema";
|
import { shows, videos } from "~/db/schema";
|
||||||
@ -48,6 +54,21 @@ describe("Get entries", () => {
|
|||||||
part: madeInAbyssVideo.part,
|
part: madeInAbyssVideo.part,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
it("Get new videos", async () => {
|
||||||
|
const [resp, body] = await getNews({ langs: "en" });
|
||||||
|
|
||||||
|
expectStatus(resp, body).toBe(200);
|
||||||
|
expect(body.items).toBeArrayOfSize(1);
|
||||||
|
expect(body.items[0].slug).toBe("made-in-abyss-s1e13");
|
||||||
|
expect(body.items[0].videos).toBeArrayOfSize(1);
|
||||||
|
expect(body.items[0].videos[0]).toMatchObject({
|
||||||
|
path: madeInAbyssVideo.path,
|
||||||
|
slug: madeInAbyssVideo.slug,
|
||||||
|
version: madeInAbyssVideo.version,
|
||||||
|
rendering: madeInAbyssVideo.rendering,
|
||||||
|
part: madeInAbyssVideo.part,
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Get extra", () => {
|
describe("Get extra", () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user