Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,10 @@ vi.mock('react-native', async () => {
View: 'View',
Modal: 'Modal',
Pressable: 'Pressable',
// The real FlatList virtualizes; the fake renders every row so the picker's
// rows are assertable.
FlatList: ({
data,
renderItem,
keyExtractor,
}: {
data: string[];
renderItem: (info: { item: string }) => React.ReactNode;
keyExtractor: (item: string) => string;
}) =>
React.createElement(
'FlatList',
{},
...data.map(item =>
React.createElement('FlatListRow', { key: keyExtractor(item) }, renderItem({ item }))
)
),
// The real ScrollView scrolls; the fake renders every row so the
// picker's rows are assertable.
ScrollView: ({ children }: { children?: React.ReactNode }) =>
React.createElement('ScrollView', {}, children),
};
});
vi.mock('@/components/ui/text', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,20 +286,19 @@ describe('PrDiffFloatingActions provider routes (s6)', () => {
pressButtonWith(GITLAB_REF, 'Comment on selected lines');

expect(routerPush).toHaveBeenCalledTimes(1);
expect(routerPush).toHaveBeenCalledWith({
pathname: '/(app)/pr-review/gitlab/group/sub/repo/12/comment-composer',
params: { path: 'src/lib.ts', side: 'RIGHT', line: 5, startLine: 3 },
});
expect(routerPush).toHaveBeenCalledWith(
'/(app)/pr-review/gitlab/group/sub/repo/12/comment-composer?path=src%2Flib.ts&side=RIGHT&line=5&startLine=3'
);
});

it.each<[ProviderPrRef, string]>([
[GITLAB_REF, '/(app)/pr-review/gitlab/group/sub/repo/12/review-submit'],
[BITBUCKET_REF, '/(app)/pr-review/bitbucket/acme/api/42/review-submit'],
])('pushes the review-submit sheet inside the %s ref route', (prRef, expectedPathname) => {
])('pushes the review-submit sheet inside the %s ref route', (prRef, expectedHref) => {
pressButtonWith(prRef, 'Finish review');

expect(routerPush).toHaveBeenCalledTimes(1);
expect(routerPush).toHaveBeenCalledWith({ pathname: expectedPathname, params: {} });
expect(routerPush).toHaveBeenCalledWith(expectedHref);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,9 @@ describe('PrMergeSectionProvider (s6)', () => {
act(() => {
findButton(renderer, 'Merge merge request')?.();
});
expect(routerPush).toHaveBeenCalledWith({
pathname: '/(app)/pr-review/gitlab/group/sub/repo/12/merge',
params: { mode: 'merge' },
});
expect(routerPush).toHaveBeenCalledWith(
'/(app)/pr-review/gitlab/group/sub/repo/12/merge?mode=merge'
);
renderer.unmount();
});

Expand All @@ -141,10 +140,9 @@ describe('PrMergeSectionProvider (s6)', () => {
act(() => {
findButton(renderer, 'Enable auto-merge')?.();
});
expect(routerPush).toHaveBeenCalledWith({
pathname: '/(app)/pr-review/gitlab/group/sub/repo/12/merge',
params: { mode: 'enable-auto-merge' },
});
expect(routerPush).toHaveBeenCalledWith(
'/(app)/pr-review/gitlab/group/sub/repo/12/merge?mode=enable-auto-merge'
);
renderer.unmount();
});

Expand Down
Loading