Skip to content
Snippets Groups Projects
Commit ebdf8a3f authored by Yusuf Akgül's avatar Yusuf Akgül :hatching_chick:
Browse files

Merge branch 'testing' of gitlab.bht-berlin.de:s86116/project_ss23

parents c36f24f7 3ad8401f
No related branches found
No related tags found
No related merge requests found
Pipeline #39320 failed
import { getGames } from "@/lib/igdb";
describe('games api', () => {
const mockGamesData = [
{
id: 1,
name: 'Game 1',
cover: {
image_id: 'cover_image_id_1',
url: 'cover_image_url_1'
},
},
{
id: 2,
name: 'Game 2',
cover: {
image_id: 'cover_image_id_2',
url: 'cover_image_url_2'
},
},
];
const mockAuthData = [
{
access_token: "1",
expires_in: 420,
token_type: 'bearer',
}
];
beforeAll(() => {
global.fetch = jest.fn()
.mockResolvedValueOnce({
ok: true,
json: () => Promise.resolve(mockAuthData),
})
.mockResolvedValueOnce({
ok: true,
json: () => Promise.resolve(mockGamesData),
});
});
test('get games', async () => {
const games = await getGames();
expect(games).toEqual(mockGamesData);
});
});
import { getGames } from "@/lib/igdb";
describe('games api', () => {
const mockGamesData = [
{
id: 1,
name: 'Game 1',
cover: {
image_id: 'cover_image_id_1',
url: 'cover_image_url_1'
},
},
{
id: 2,
name: 'Game 2',
cover: {
image_id: 'cover_image_id_2',
url: 'cover_image_url_2'
},
},
];
const mockAuthData = [
{
access_token: "1",
expires_in: 420,
token_type: 'bearer',
}
]
beforeAll(async () => {
global.fetch = jest.fn()
.mockResolvedValueOnce(() => Promise.resolve({
ok: true,
json: () => Promise.resolve(mockAuthData),
}))
.mockResolvedValueOnce(() => Promise.resolve({
ok: true,
json: () => Promise.resolve(mockGamesData),
}))
});
test('get games', async () => {
const games = await getGames();
expect(games).toEqual("Game 1");
});
});
\ No newline at end of file
File moved
......@@ -23,6 +23,11 @@ const serverTestConfig = {
const config = {
// Add more setup options before each test is run
projects: [await createJestConfig(clientTestConfig)(), await createJestConfig(serverTestConfig)()],
collectCoverageFrom: [
'**/app/api/**',
'!**/node_modules/**',
'!**/vendor/**',
]
};
export default config;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment