1.3 KB48 lines
Blame
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8import {act, screen, waitFor, within} from '@testing-library/react';
9import {initRepo} from './setup';
10
11describe('merge conflicts integration test', () => {
12 it('shows conflicts, supports resolving, and continuing the operation', async () => {
13 const {cleanup, sl, drawdag, writeFileInRepo, refresh} = await initRepo();
14 const {ignoreRTL} = await import('../src/testQueries');
15 await act(() =>
16 drawdag(`
17 C
18 |
19 B
20 |
21 A
22 .
23python:
24commit('C', files={"file1.txt": "bar\\n"})
25commit('B', files={"file1.txt": "foo\\n"})
26commit('A', files={"file1.txt": "base\\n"})
27 `),
28 );
29
30 await act(async () => {
31 await sl(['goto', 'desc(B)']);
32 await writeFileInRepo('file1.txt', 'conflict');
33 // this amend onto B will hit conflicts with C
34 await sl(['amend', '--rebase']).catch(() => undefined);
35 });
36 refresh();
37
38 await waitFor(() =>
39 within(screen.getByTestId('commit-tree-root')).getByText('Unresolved Merge Conflicts'),
40 );
41 await waitFor(() =>
42 within(screen.getByTestId('commit-tree-root')).getByText(ignoreRTL('file1.txt')),
43 );
44
45 await act(cleanup);
46 });
47});
48