diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-15 09:12:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-15 09:12:42 +0300 |
commit | defacc074a4a576e15021ba264de745af982b45d (patch) | |
tree | 3695e700025e6501f3a61bd64f8a84eaa4b12ca4 /spec/frontend/__helpers__ | |
parent | 1b5891ee8ce8adc6877c462ea292eaee3c4ab30b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/__helpers__')
4 files changed, 0 insertions, 88 deletions
diff --git a/spec/frontend/__helpers__/matchers/index.js b/spec/frontend/__helpers__/matchers/index.js index 73464135950..5da6676cdc1 100644 --- a/spec/frontend/__helpers__/matchers/index.js +++ b/spec/frontend/__helpers__/matchers/index.js @@ -3,4 +3,3 @@ export * from './to_have_tracking_attributes'; export * from './to_match_interpolated_text'; export * from './to_validate_json_schema'; export * from './to_match_expected_for_markdown'; -export * from './to_equal_graphql_fixture'; diff --git a/spec/frontend/__helpers__/matchers/to_equal_graphql_fixture.js b/spec/frontend/__helpers__/matchers/to_equal_graphql_fixture.js deleted file mode 100644 index 1a095de1deb..00000000000 --- a/spec/frontend/__helpers__/matchers/to_equal_graphql_fixture.js +++ /dev/null @@ -1,28 +0,0 @@ -import { isEqual } from 'lodash'; -import { stripTypenames } from 'helpers/graphql_helpers'; - -export function toEqualGraphqlFixture(received, match) { - let clearReceived; - let clearMatch; - - try { - clearReceived = JSON.parse(JSON.stringify(received)); - clearMatch = stripTypenames(match); - } catch (e) { - return { message: () => 'The comparator value is not an object', pass: false }; - } - const pass = isEqual(clearReceived, clearMatch); - // console.log(this.utils); - const message = pass - ? () => ` - Expected to not be: ${this.utils.printExpected(clearMatch)} - Received: ${this.utils.printReceived(clearReceived)} - ` - : () => - ` - Expected to be: ${this.utils.printExpected(clearMatch)} - Received: ${this.utils.printReceived(clearReceived)} - `; - - return { actual: received, message, pass }; -} diff --git a/spec/frontend/__helpers__/matchers/to_equal_graphql_fixture_spec.js b/spec/frontend/__helpers__/matchers/to_equal_graphql_fixture_spec.js deleted file mode 100644 index 00adc8cfc8d..00000000000 --- a/spec/frontend/__helpers__/matchers/to_equal_graphql_fixture_spec.js +++ /dev/null @@ -1,58 +0,0 @@ -describe('custom matcher toEqualGraphqlFixture', () => { - const key = 'value'; - const key2 = 'value2'; - - describe('positive assertion', () => { - it.each([ - [{}, {}], - [{ undef: undefined }, { undef: undefined }], - [{}, { __typename: 'MyType' }], - [{ key }, { key, __typename: 'MyType' }], - [ - { obj: { key } }, - { - obj: { - key, - __typename: 'MyNestedType', - }, - __typename: 'MyType', - }, - ], - [[{ key }], [{ key }]], - [ - [{ key }], - [ - { - key, - __typename: 'MyCollectionType', - }, - ], - ], - ])('%j equals %j', (received, match) => { - expect(received).toEqualGraphqlFixture(match); - }); - }); - - describe('negative assertion', () => { - it.each([ - [{ __typename: 'MyType' }, {}], - [{ key }, { key2, __typename: 'MyType' }], - [ - { key, key2 }, - { key2, __typename: 'MyType' }, - ], - [[{ key }, { key2 }], [{ key }]], - [ - [{ key, key2 }], - [ - { - key, - __typename: 'MyCollectionType', - }, - ], - ], - ])('%j does not equal %j', (received, match) => { - expect(received).not.toEqualGraphqlFixture(match); - }); - }); -}); diff --git a/spec/frontend/__helpers__/mock_apollo_helper.js b/spec/frontend/__helpers__/mock_apollo_helper.js index bae9f33be87..e0739df7086 100644 --- a/spec/frontend/__helpers__/mock_apollo_helper.js +++ b/spec/frontend/__helpers__/mock_apollo_helper.js @@ -8,7 +8,6 @@ export function createMockClient(handlers = [], resolvers = {}, cacheOptions = { const cache = new InMemoryCache({ possibleTypes, typePolicies, - addTypename: false, ...cacheOptions, }); |