Skip to content

Commit 8e16a9b

Browse files
committed
fix failing tests and mocks correctly
1 parent 388b9a1 commit 8e16a9b

2 files changed

Lines changed: 15 additions & 17 deletions

File tree

templates/boilerplate/src/__tests__/App.integration.test.tsx

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { screen, userEvent } from '@testing-library/react-native';
22

33
import mock from 'src/test/mock';
44
import { renderApplication } from 'src/test/render';
5-
import { GithubProjectsResponse } from 'src/util/api/api';
5+
import type { GithubRepo } from 'src/util/api/api';
66

77
// Testing philosophy:
88
// - Tests that render the entire application with `renderApplication` go in the
@@ -37,22 +37,20 @@ test('renders app, can navigate between screens', async () => {
3737
// Pass this mock to `render` or `renderApplication` to register it with MSW.
3838
// Recommended to place these mocks in a central location like `src/test/mocks`
3939
function mockGitHubProjects() {
40-
return mock.get<GithubProjectsResponse, null>(
41-
'https://thoughtbot-projects-api-68b03dc59059.herokuapp.com/api/projects',
40+
return mock.get<GithubRepo[], null>(
41+
'https://api.github.com/orgs/thoughtbot/repos',
4242
{
43-
response: {
44-
projects: [
45-
{
46-
id: 635980144,
47-
name: 'belt',
48-
description:
49-
'Belt is a CLI for starting a new React Native Expo app and will even keep your pants secure as you continue development.',
50-
url: 'https://github.com/thoughtbot/belt',
51-
stars: 8,
52-
forks: 0,
53-
},
54-
],
55-
},
43+
response: [
44+
{
45+
id: 635980144,
46+
name: 'belt',
47+
description:
48+
'Belt is a CLI for starting a new React Native Expo app and will even keep your pants secure as you continue development.',
49+
html_url: 'https://github.com/thoughtbot/belt',
50+
stargazers_count: 8,
51+
forks_count: 0,
52+
},
53+
],
5654
},
5755
);
5856
}

templates/boilerplate/src/util/api/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export type GithubProjectsResponse = {
4949
projects: GithubProject[];
5050
};
5151

52-
type GithubRepo = {
52+
export type GithubRepo = {
5353
id: number;
5454
name: string;
5555
description: string | null;

0 commit comments

Comments
 (0)