diff options
Diffstat (limited to 'spec/frontend/pages/projects/forks/new/components/fork_form_spec.js')
-rw-r--r-- | spec/frontend/pages/projects/forks/new/components/fork_form_spec.js | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/spec/frontend/pages/projects/forks/new/components/fork_form_spec.js b/spec/frontend/pages/projects/forks/new/components/fork_form_spec.js index c80ccfa8256..dd617b1ffc2 100644 --- a/spec/frontend/pages/projects/forks/new/components/fork_form_spec.js +++ b/spec/frontend/pages/projects/forks/new/components/fork_form_spec.js @@ -29,10 +29,12 @@ describe('ForkForm component', () => { const MOCK_NAMESPACES_RESPONSE = [ { name: 'one', + full_name: 'one-group/one', id: 1, }, { name: 'two', + full_name: 'two-group/two', id: 2, }, ]; @@ -155,7 +157,7 @@ describe('ForkForm component', () => { describe('forks namespaces', () => { beforeEach(() => { mockGetRequest({ namespaces: MOCK_NAMESPACES_RESPONSE }); - createComponent(); + createFullComponent(); }); it('make GET request from endpoint', async () => { @@ -178,8 +180,23 @@ describe('ForkForm component', () => { const optionsArray = findForkUrlInput().findAll('option'); expect(optionsArray).toHaveLength(MOCK_NAMESPACES_RESPONSE.length + 1); - expect(optionsArray.at(1).text()).toBe(MOCK_NAMESPACES_RESPONSE[0].name); - expect(optionsArray.at(2).text()).toBe(MOCK_NAMESPACES_RESPONSE[1].name); + expect(optionsArray.at(1).text()).toBe(MOCK_NAMESPACES_RESPONSE[0].full_name); + expect(optionsArray.at(2).text()).toBe(MOCK_NAMESPACES_RESPONSE[1].full_name); + }); + + it('set namespaces in alphabetical order', async () => { + const namespace = { + name: 'three', + full_name: 'aaa/three', + id: 3, + }; + mockGetRequest({ + namespaces: [...MOCK_NAMESPACES_RESPONSE, namespace], + }); + createComponent(); + await axios.waitForAll(); + + expect(wrapper.vm.namespaces).toEqual([namespace, ...MOCK_NAMESPACES_RESPONSE]); }); }); |