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

Merge branch 'main' of gitlab.bht-berlin.de:s86116/project_ss23 into emailVerify

parents 707f8942 ebdf8a3f
No related branches found
No related tags found
1 merge request!45Email verify
Pipeline #39321 failed
......@@ -35,14 +35,14 @@ unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
script:
- echo "Running unit tests... This will take about 10 seconds."
- sleep 1
- npm run test
- echo "Code coverage is 90%"
lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 1
- npm run lint
- echo "No lint issues found."
deploy-job: # This job runs in the deploy stage.
......
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