Commit c23fbf04 authored by Chad Woolley's avatar Chad Woolley

Remove unnecessary reference to CAPTCHA

- There is no longer any CAPTCHA-specific
  code in the components, we don't need to
  test CAPTCHA errors specifically
parent 336e847d
...@@ -7,7 +7,6 @@ import { useFakeDate } from 'helpers/fake_date'; ...@@ -7,7 +7,6 @@ import { useFakeDate } from 'helpers/fake_date';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import waitForPromises from 'helpers/wait_for_promises'; import waitForPromises from 'helpers/wait_for_promises';
import GetSnippetQuery from 'shared_queries/snippet/snippet.query.graphql'; import GetSnippetQuery from 'shared_queries/snippet/snippet.query.graphql';
import UnsolvedCaptchaError from '~/captcha/unsolved_captcha_error';
import createFlash from '~/flash'; import createFlash from '~/flash';
import * as urlUtils from '~/lib/utils/url_utility'; import * as urlUtils from '~/lib/utils/url_utility';
import SnippetEditApp from '~/snippets/components/edit.vue'; import SnippetEditApp from '~/snippets/components/edit.vue';
...@@ -29,7 +28,6 @@ jest.mock('~/flash'); ...@@ -29,7 +28,6 @@ jest.mock('~/flash');
const TEST_UPLOADED_FILES = ['foo/bar.txt', 'alpha/beta.js']; const TEST_UPLOADED_FILES = ['foo/bar.txt', 'alpha/beta.js'];
const TEST_API_ERROR = new Error('TEST_API_ERROR'); const TEST_API_ERROR = new Error('TEST_API_ERROR');
const TEST_CAPTCHA_ERROR = new UnsolvedCaptchaError();
const TEST_MUTATION_ERROR = 'Test mutation error'; const TEST_MUTATION_ERROR = 'Test mutation error';
const TEST_ACTIONS = { const TEST_ACTIONS = {
NO_CONTENT: merge({}, testEntries.created.diff, { content: '' }), NO_CONTENT: merge({}, testEntries.created.diff, { content: '' }),
...@@ -325,10 +323,10 @@ describe('Snippet Edit app', () => { ...@@ -325,10 +323,10 @@ describe('Snippet Edit app', () => {
}, },
); );
describe.each([TEST_API_ERROR, TEST_CAPTCHA_ERROR])('with apollo network error', (error) => { describe('with apollo network error', () => {
beforeEach(async () => { beforeEach(async () => {
jest.spyOn(console, 'error').mockImplementation(); jest.spyOn(console, 'error').mockImplementation();
mutateSpy.mockRejectedValue(error); mutateSpy.mockRejectedValue(TEST_API_ERROR);
await createComponentAndSubmit(); await createComponentAndSubmit();
}); });
...@@ -340,7 +338,7 @@ describe('Snippet Edit app', () => { ...@@ -340,7 +338,7 @@ describe('Snippet Edit app', () => {
it('should flash', () => { it('should flash', () => {
// Apollo automatically wraps the resolver's error in a NetworkError // Apollo automatically wraps the resolver's error in a NetworkError
expect(createFlash).toHaveBeenCalledWith({ expect(createFlash).toHaveBeenCalledWith({
message: `Can't update snippet: Network error: ${error.message}`, message: `Can't update snippet: Network error: ${TEST_API_ERROR.message}`,
}); });
}); });
...@@ -350,7 +348,7 @@ describe('Snippet Edit app', () => { ...@@ -350,7 +348,7 @@ describe('Snippet Edit app', () => {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
expect(console.error).toHaveBeenCalledWith( expect(console.error).toHaveBeenCalledWith(
'[gitlab] unexpected error while updating snippet', '[gitlab] unexpected error while updating snippet',
expect.objectContaining({ message: `Network error: ${error.message}` }), expect.objectContaining({ message: `Network error: ${TEST_API_ERROR.message}` }),
); );
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment