addons/isl/integrationTests/mergeConflicts.test.tsxblame
View source
b69ab311/**
b69ab312 * Copyright (c) Meta Platforms, Inc. and affiliates.
b69ab313 *
b69ab314 * This source code is licensed under the MIT license found in the
b69ab315 * LICENSE file in the root directory of this source tree.
b69ab316 */
b69ab317
b69ab318import {act, screen, waitFor, within} from '@testing-library/react';
b69ab319import {initRepo} from './setup';
b69ab3110
b69ab3111describe('merge conflicts integration test', () => {
b69ab3112 it('shows conflicts, supports resolving, and continuing the operation', async () => {
b69ab3113 const {cleanup, sl, drawdag, writeFileInRepo, refresh} = await initRepo();
b69ab3114 const {ignoreRTL} = await import('../src/testQueries');
b69ab3115 await act(() =>
b69ab3116 drawdag(`
b69ab3117 C
b69ab3118 |
b69ab3119 B
b69ab3120 |
b69ab3121 A
b69ab3122 .
b69ab3123python:
b69ab3124commit('C', files={"file1.txt": "bar\\n"})
b69ab3125commit('B', files={"file1.txt": "foo\\n"})
b69ab3126commit('A', files={"file1.txt": "base\\n"})
b69ab3127 `),
b69ab3128 );
b69ab3129
b69ab3130 await act(async () => {
b69ab3131 await sl(['goto', 'desc(B)']);
b69ab3132 await writeFileInRepo('file1.txt', 'conflict');
b69ab3133 // this amend onto B will hit conflicts with C
b69ab3134 await sl(['amend', '--rebase']).catch(() => undefined);
b69ab3135 });
b69ab3136 refresh();
b69ab3137
b69ab3138 await waitFor(() =>
b69ab3139 within(screen.getByTestId('commit-tree-root')).getByText('Unresolved Merge Conflicts'),
b69ab3140 );
b69ab3141 await waitFor(() =>
b69ab3142 within(screen.getByTestId('commit-tree-root')).getByText(ignoreRTL('file1.txt')),
b69ab3143 );
b69ab3144
b69ab3145 await act(cleanup);
b69ab3146 });
b69ab3147});