From fbf42c926b1506c42ee45a3f373ee3f2a0102cfa Mon Sep 17 00:00:00 2001 From: nsdeschenes Date: Tue, 8 Dec 2020 06:58:36 -0400 Subject: [PATCH 1/3] refactor name --- api-js/src/types/base.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api-js/src/types/base.js b/api-js/src/types/base.js index d045c82c9..26d338dbb 100644 --- a/api-js/src/types/base.js +++ b/api-js/src/types/base.js @@ -305,7 +305,7 @@ const dkimType = new GraphQLObjectType({ resolve: ({ timestamp }) => timestamp, }, results: { - type: dkimResultsConnection.connectionType, + type: dkimResultConnection.connectionType, args: { ...connectionArgs, }, @@ -343,7 +343,7 @@ const dkimConnection = connectionDefinitions({ }), }) -const dkimResultsType = new GraphQLObjectType({ +const dkimResultType = new GraphQLObjectType({ name: 'DKIMResult', fields: () => ({ id: globalIdField('dkimResult'), @@ -395,9 +395,9 @@ const dkimResultsType = new GraphQLObjectType({ description: 'Individual scans results for the given dkim selector.', }) -const dkimResultsConnection = connectionDefinitions({ +const dkimResultConnection = connectionDefinitions({ name: 'DKIMResult', - nodeType: dkimResultsType, + nodeType: dkimResultType, connectionFields: () => ({ totalCount: { type: GraphQLInt, @@ -1227,8 +1227,8 @@ const verifiedOrganizationConnection = connectionDefinitions({ module.exports = { dkimType, dkimConnection, - dkimResultsType, - dkimResultsConnection, + dkimResultType, + dkimResultConnection, dmarcType, dmarcConnection, domainType, From e6114d0b4f78b26b10aeb62f743591e6aa5368c9 Mon Sep 17 00:00:00 2001 From: nsdeschenes Date: Tue, 8 Dec 2020 06:58:44 -0400 Subject: [PATCH 2/3] update related tests --- .../__tests__/dkim-results-connection.test.js | 6 ++--- .../src/types/__tests__/dkim-results.test.js | 26 +++++++++---------- api-js/src/types/__tests__/dkim.test.js | 4 +-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/api-js/src/types/__tests__/dkim-results-connection.test.js b/api-js/src/types/__tests__/dkim-results-connection.test.js index 959ef62c7..d98bd64f0 100644 --- a/api-js/src/types/__tests__/dkim-results-connection.test.js +++ b/api-js/src/types/__tests__/dkim-results-connection.test.js @@ -1,10 +1,10 @@ const { GraphQLInt } = require('graphql') -const { dkimResultsConnection } = require('../index') +const { dkimResultConnection } = require('../index') describe('given the dkim result connection object', () => { describe('testing its field definitions', () => { it('has a totalCount field', () => { - const demoType = dkimResultsConnection.connectionType.getFields() + const demoType = dkimResultConnection.connectionType.getFields() expect(demoType).toHaveProperty('totalCount') expect(demoType.totalCount.type).toMatchObject(GraphQLInt) @@ -13,7 +13,7 @@ describe('given the dkim result connection object', () => { describe('testing its field resolvers', () => { describe('testing the totalCount resolver', () => { it('returns the resolved value', () => { - const demoType = dkimResultsConnection.connectionType.getFields() + const demoType = dkimResultConnection.connectionType.getFields() expect(demoType.totalCount.resolve({ totalCount: 1 })).toEqual(1) }) diff --git a/api-js/src/types/__tests__/dkim-results.test.js b/api-js/src/types/__tests__/dkim-results.test.js index c7d31ea53..4d54ac58b 100644 --- a/api-js/src/types/__tests__/dkim-results.test.js +++ b/api-js/src/types/__tests__/dkim-results.test.js @@ -10,42 +10,42 @@ const { dkimLoaderByKey, dkimGuidanceTagConnectionsLoader, } = require('../../loaders') -const { dkimResultsType, dkimType, guidanceTagConnection } = require('../index') +const { dkimResultType, dkimType, guidanceTagConnection } = require('../index') describe('given the dkim result object', () => { describe('testing its field definitions', () => { it('has an id field', () => { - const demoType = dkimResultsType.getFields() + const demoType = dkimResultType.getFields() expect(demoType).toHaveProperty('id') expect(demoType.id.type).toMatchObject(GraphQLNonNull(GraphQLID)) }) it('has a dkim field', () => { - const demoType = dkimResultsType.getFields() + const demoType = dkimResultType.getFields() expect(demoType).toHaveProperty('dkim') expect(demoType.dkim.type).toEqual(dkimType) }) it('has a selector field', () => { - const demoType = dkimResultsType.getFields() + const demoType = dkimResultType.getFields() expect(demoType).toHaveProperty('selector') expect(demoType.selector.type).toEqual(GraphQLString) }) it('has a record field', () => { - const demoType = dkimResultsType.getFields() + const demoType = dkimResultType.getFields() expect(demoType).toHaveProperty('record') expect(demoType.record.type).toMatchObject(GraphQLString) }) it('has a keyLength field', () => { - const demoType = dkimResultsType.getFields() + const demoType = dkimResultType.getFields() expect(demoType).toHaveProperty('keyLength') expect(demoType.keyLength.type).toMatchObject(GraphQLString) }) it('has a guidanceTags field', () => { - const demoType = dkimResultsType.getFields() + const demoType = dkimResultType.getFields() expect(demoType).toHaveProperty('guidanceTags') expect(demoType.guidanceTags.type).toEqual( @@ -103,7 +103,7 @@ describe('given the dkim result object', () => { describe('testing the id resolver', () => { it('returns the resolved value', () => { - const demoType = dkimResultsType.getFields() + const demoType = dkimResultType.getFields() expect(demoType.id.resolve({ id: '1' })).toEqual( toGlobalId('dkimResult', 1), @@ -112,7 +112,7 @@ describe('given the dkim result object', () => { }) describe('testing the dkim resolver', () => { it('returns the resolved value', async () => { - const demoType = dkimResultsType.getFields() + const demoType = dkimResultType.getFields() const loader = dkimLoaderByKey(query, '1', {}) @@ -133,7 +133,7 @@ describe('given the dkim result object', () => { }) describe('testing the selector field', () => { it('returns the resolved value', () => { - const demoType = dkimResultsType.getFields() + const demoType = dkimResultType.getFields() expect( demoType.selector.resolve({ selector: 'selector._dkim1' }), @@ -142,7 +142,7 @@ describe('given the dkim result object', () => { }) describe('testing the record resolver', () => { it('returns the resolved value', () => { - const demoType = dkimResultsType.getFields() + const demoType = dkimResultType.getFields() expect(demoType.record.resolve({ record: 'txtRecord' })).toEqual( 'txtRecord', @@ -151,7 +151,7 @@ describe('given the dkim result object', () => { }) describe('testing the keyLength resolver', () => { it('returns the resolved value', () => { - const demoType = dkimResultsType.getFields() + const demoType = dkimResultType.getFields() expect(demoType.keyLength.resolve({ keyLength: '2048' })).toEqual( '2048', @@ -160,7 +160,7 @@ describe('given the dkim result object', () => { }) describe('testing the guidanceTags resolver', () => { it('returns the resolved value', async () => { - const demoType = dkimResultsType.getFields() + const demoType = dkimResultType.getFields() const loader = dkimGuidanceTagConnectionsLoader( query, diff --git a/api-js/src/types/__tests__/dkim.test.js b/api-js/src/types/__tests__/dkim.test.js index ea911a998..af06a6785 100644 --- a/api-js/src/types/__tests__/dkim.test.js +++ b/api-js/src/types/__tests__/dkim.test.js @@ -10,7 +10,7 @@ const { domainLoaderByKey, dkimResultsLoaderConnectionByDkimId, } = require('../../loaders') -const { dkimType, domainType, dkimResultsConnection } = require('../index') +const { dkimType, domainType, dkimResultConnection } = require('../index') describe('given the dkimType object', () => { describe('testing its field definitions', () => { @@ -37,7 +37,7 @@ describe('given the dkimType object', () => { expect(demoType).toHaveProperty('results') expect(demoType.results.type).toMatchObject( - dkimResultsConnection.connectionType, + dkimResultConnection.connectionType, ) }) }) From e911dbeb80085ae26c50aaa1f0fed829e5c635a8 Mon Sep 17 00:00:00 2001 From: nsdeschenes Date: Tue, 8 Dec 2020 06:59:10 -0400 Subject: [PATCH 3/3] prettier ran on code base --- api-js/src/__tests__/server.test.js | 8 ++- .../__tests__/check-domain-permission.test.js | 24 ++++----- api-js/src/create-context.js | 6 ++- .../generate-detail-table-fields.test.js | 36 ++++++++----- .../dmarc-report/generate-gql-query.js | 10 ++-- .../__tests__/load-domain-conn-org-id.test.js | 25 ++++----- ...load-dkim-connections-by-domain-id.test.js | 5 +- ...oad-dmarc-connections-by-domain-id.test.js | 5 +- ...anization-connections-by-domain-id.test.js | 5 +- .../load-verified-domain-connections.test.js | 5 +- ...oad-https-connections-by-domain-id.test.js | 5 +- .../__tests__/remove-user-from-org.test.js | 54 ++++--------------- .../user-affiliations/remove-user-from-org.js | 4 +- api-js/src/mutations/user/send-phone-code.js | 2 +- .../src/mutations/user/update-user-profile.js | 2 +- api-js/src/queries/domains/find-my-domains.js | 3 +- .../types/__tests__/dkim-connection.test.js | 2 +- .../__tests__/dkim-results-connection.test.js | 2 +- api-js/src/types/__tests__/domain.test.js | 7 ++- .../src/types/__tests__/user-shared.test.js | 5 +- .../verified-domain-connection.test.js | 2 +- .../verified-organization-connection.test.js | 2 +- .../__tests__/dkim-failure-table.test.js | 6 +-- 23 files changed, 99 insertions(+), 126 deletions(-) diff --git a/api-js/src/__tests__/server.test.js b/api-js/src/__tests__/server.test.js index 3adeaa16c..9e9b11c58 100644 --- a/api-js/src/__tests__/server.test.js +++ b/api-js/src/__tests__/server.test.js @@ -93,10 +93,14 @@ describe('parse server', () => { ) .post('/graphql') .set('Accept', 'application/json') - .send({ query: '{findVerifiedDomains (first: 5) { edges { node { id }}}}' }) + .send({ + query: '{findVerifiedDomains (first: 5) { edges { node { id }}}}', + }) expect(response.status).toEqual(400) - expect(response.text).toEqual(expect.stringContaining('exceeds maximum operation depth')) + expect(response.text).toEqual( + expect.stringContaining('exceeds maximum operation depth'), + ) }) }) }) diff --git a/api-js/src/auth/__tests__/check-domain-permission.test.js b/api-js/src/auth/__tests__/check-domain-permission.test.js index fd0381830..acf52a192 100644 --- a/api-js/src/auth/__tests__/check-domain-permission.test.js +++ b/api-js/src/auth/__tests__/check-domain-permission.test.js @@ -187,7 +187,9 @@ describe('given the check domain permission function', () => { await testCheckDomainPermission({ domainId: domain._id }) } catch (err) { expect(err).toEqual( - new Error('Permission check error. Unable to request domain information.'), + new Error( + 'Permission check error. Unable to request domain information.', + ), ) expect(consoleOutput).toEqual([ `Database error when retrieving super admin claims for user: ${user._id} and domain: ${domain._id}: Error: Database error occurred.`, @@ -211,7 +213,9 @@ describe('given the check domain permission function', () => { await testCheckDomainPermission({ domainId: domain._id }) } catch (err) { expect(err).toEqual( - new Error('Permission check error. Unable to request domain information.'), + new Error( + 'Permission check error. Unable to request domain information.', + ), ) expect(consoleOutput).toEqual([ `Database error when retrieving affiliated organization claims for user: ${user._id} and domain: ${domain._id}: Error: Database error occurred.`, @@ -240,7 +244,9 @@ describe('given the check domain permission function', () => { await testCheckDomainPermission({ domainId: domain._id }) } catch (err) { expect(err).toEqual( - new Error('Permission check error. Unable to request domain information.'), + new Error( + 'Permission check error. Unable to request domain information.', + ), ) expect(consoleOutput).toEqual([ `Cursor error when retrieving affiliated organization claims for user: ${user._id} and domain: ${domain._id}: Error: Cursor error occurred.`, @@ -275,9 +281,7 @@ describe('given the check domain permission function', () => { }) await testCheckDomainPermission({ domainId: domain._id }) } catch (err) { - expect(err).toEqual( - new Error('todo'), - ) + expect(err).toEqual(new Error('todo')) expect(consoleOutput).toEqual([ `Database error when retrieving super admin claims for user: ${user._id} and domain: ${domain._id}: Error: Database error occurred.`, ]) @@ -299,9 +303,7 @@ describe('given the check domain permission function', () => { }) await testCheckDomainPermission({ domainId: domain._id }) } catch (err) { - expect(err).toEqual( - new Error('todo'), - ) + expect(err).toEqual(new Error('todo')) expect(consoleOutput).toEqual([ `Database error when retrieving affiliated organization claims for user: ${user._id} and domain: ${domain._id}: Error: Database error occurred.`, ]) @@ -328,9 +330,7 @@ describe('given the check domain permission function', () => { }) await testCheckDomainPermission({ domainId: domain._id }) } catch (err) { - expect(err).toEqual( - new Error('todo'), - ) + expect(err).toEqual(new Error('todo')) expect(consoleOutput).toEqual([ `Cursor error when retrieving affiliated organization claims for user: ${user._id} and domain:${domain._id}: Error: Cursor error occurred.`, ]) diff --git a/api-js/src/create-context.js b/api-js/src/create-context.js index 0b205dfca..d5c6cac7e 100644 --- a/api-js/src/create-context.js +++ b/api-js/src/create-context.js @@ -103,7 +103,11 @@ module.exports.createContext = ({ context, req: request, res: response }) => { checkDomainOwnership: checkDomainOwnership({ i18n, userKey, query }), checkDomainPermission: checkDomainPermission({ i18n, userKey, query }), checkPermission: checkPermission({ i18n, userKey, query }), - checkUserIsAdminForUser: checkUserIsAdminForUser({ i18n, userKey, query }), + checkUserIsAdminForUser: checkUserIsAdminForUser({ + i18n, + userKey, + query, + }), tokenize, userRequired: userRequired({ i18n, diff --git a/api-js/src/loaders/dmarc-report/__tests__/generate-detail-table-fields.test.js b/api-js/src/loaders/dmarc-report/__tests__/generate-detail-table-fields.test.js index b096b14e1..928561f48 100644 --- a/api-js/src/loaders/dmarc-report/__tests__/generate-detail-table-fields.test.js +++ b/api-js/src/loaders/dmarc-report/__tests__/generate-detail-table-fields.test.js @@ -123,9 +123,12 @@ describe('given the generateDetailTableFields function', () => { const variables = { first: 5, } - - const detailTableField = generateDetailTableFields({ subField, variables }) - + + const detailTableField = generateDetailTableFields({ + subField, + variables, + }) + expect(detailTableField).toEqual({ edgeSelection: '', pageInfoSelection: '', @@ -154,9 +157,12 @@ describe('given the generateDetailTableFields function', () => { const variables = { last: 5, } - - const detailTableField = generateDetailTableFields({ subField, variables }) - + + const detailTableField = generateDetailTableFields({ + subField, + variables, + }) + expect(detailTableField).toEqual({ edgeSelection: '', pageInfoSelection: '', @@ -185,9 +191,12 @@ describe('given the generateDetailTableFields function', () => { const variables = { before: 'SGVsbG8xMjM0', } - - const detailTableField = generateDetailTableFields({ subField, variables }) - + + const detailTableField = generateDetailTableFields({ + subField, + variables, + }) + expect(detailTableField).toEqual({ edgeSelection: '', pageInfoSelection: '', @@ -216,9 +225,12 @@ describe('given the generateDetailTableFields function', () => { const variables = { after: 'SGVsbG8xMjM0', } - - const detailTableField = generateDetailTableFields({ subField, variables }) - + + const detailTableField = generateDetailTableFields({ + subField, + variables, + }) + expect(detailTableField).toEqual({ edgeSelection: '', pageInfoSelection: '', diff --git a/api-js/src/loaders/dmarc-report/generate-gql-query.js b/api-js/src/loaders/dmarc-report/generate-gql-query.js index f95fef8d3..65276b8f1 100644 --- a/api-js/src/loaders/dmarc-report/generate-gql-query.js +++ b/api-js/src/loaders/dmarc-report/generate-gql-query.js @@ -53,12 +53,14 @@ const generateGqlQuery = ({ generateDetailTableFields }) => ({ if (arg.value.kind === 'Variable') if (arg.value.name.value === 'month') { queryArgs.push( - `${arg.name.value}: ${ - String(info.variableValues[arg.value.name.value]).toUpperCase() - }`, + `${arg.name.value}: ${String( + info.variableValues[arg.value.name.value], + ).toUpperCase()}`, ) } else { - if (typeof info.variableValues[arg.value.name.value] === 'string') { + if ( + typeof info.variableValues[arg.value.name.value] === 'string' + ) { queryArgs.push( `${arg.name.value}: "${ info.variableValues[arg.value.name.value] diff --git a/api-js/src/loaders/domains/__tests__/load-domain-conn-org-id.test.js b/api-js/src/loaders/domains/__tests__/load-domain-conn-org-id.test.js index 30e18bd3e..c73f7ba46 100644 --- a/api-js/src/loaders/domains/__tests__/load-domain-conn-org-id.test.js +++ b/api-js/src/loaders/domains/__tests__/load-domain-conn-org-id.test.js @@ -8,10 +8,7 @@ const englishMessages = require('../../../locale/en/messages') const frenchMessages = require('../../../locale/fr/messages') const { makeMigrations } = require('../../../../migrations') const { cleanseInput } = require('../../../validators') -const { - domainLoaderConnectionsByOrgId, - domainLoaderByKey, -} = require('../..') +const { domainLoaderConnectionsByOrgId, domainLoaderByKey } = require('../..') const { toGlobalId } = require('graphql-relay') describe('given the load domain connection using org id function', () => { @@ -29,7 +26,7 @@ describe('given the load domain connection using org id function', () => { let consoleOutput = [] const mockedError = (output) => consoleOutput.push(output) const mockedWarn = (output) => consoleOutput.push(output) - + beforeAll(async () => { console.error = mockedError console.warn = mockedWarn @@ -393,14 +390,14 @@ describe('given the load domain connection using org id function', () => { user._key, cleanseInput, ) - + const domainLoader = domainLoaderByKey(query) const expectedDomains = await domainLoader.loadMany([ domainThree._key, ]) - + expectedDomains[0].id = expectedDomains[0]._key - + const connectionArgs = { first: 5, } @@ -409,7 +406,7 @@ describe('given the load domain connection using org id function', () => { ownership: true, ...connectionArgs, }) - + const expectedStructure = { edges: [ { @@ -427,7 +424,7 @@ describe('given the load domain connection using org id function', () => { }, totalCount: 1, } - + expect(domains).toEqual(expectedStructure) }) }) @@ -438,14 +435,14 @@ describe('given the load domain connection using org id function', () => { user._key, cleanseInput, ) - + const domainLoader = domainLoaderByKey(query) const expectedDomains = await domainLoader.loadMany([ domain._key, domainTwo._key, domainThree._key, ]) - + const connectionArgs = { first: 5, } @@ -454,7 +451,7 @@ describe('given the load domain connection using org id function', () => { ownership: false, ...connectionArgs, }) - + const expectedStructure = { edges: [ { @@ -484,7 +481,7 @@ describe('given the load domain connection using org id function', () => { }, totalCount: 3, } - + expect(domains).toEqual(expectedStructure) }) }) diff --git a/api-js/src/loaders/email-scan/__tests__/load-dkim-connections-by-domain-id.test.js b/api-js/src/loaders/email-scan/__tests__/load-dkim-connections-by-domain-id.test.js index f6f3344f2..d4bd6badd 100644 --- a/api-js/src/loaders/email-scan/__tests__/load-dkim-connections-by-domain-id.test.js +++ b/api-js/src/loaders/email-scan/__tests__/load-dkim-connections-by-domain-id.test.js @@ -9,10 +9,7 @@ const englishMessages = require('../../../locale/en/messages') const frenchMessages = require('../../../locale/fr/messages') const { makeMigrations } = require('../../../../migrations') const { cleanseInput } = require('../../../validators') -const { - dkimLoaderConnectionsByDomainId, - dkimLoaderByKey, -} = require('../..') +const { dkimLoaderConnectionsByDomainId, dkimLoaderByKey } = require('../..') describe('when given the load dkim connection function', () => { let query, drop, truncate, migrate, collections, user, domain, i18n diff --git a/api-js/src/loaders/email-scan/__tests__/load-dmarc-connections-by-domain-id.test.js b/api-js/src/loaders/email-scan/__tests__/load-dmarc-connections-by-domain-id.test.js index c4d312732..76681105d 100644 --- a/api-js/src/loaders/email-scan/__tests__/load-dmarc-connections-by-domain-id.test.js +++ b/api-js/src/loaders/email-scan/__tests__/load-dmarc-connections-by-domain-id.test.js @@ -9,10 +9,7 @@ const englishMessages = require('../../../locale/en/messages') const frenchMessages = require('../../../locale/fr/messages') const { makeMigrations } = require('../../../../migrations') const { cleanseInput } = require('../../../validators') -const { - dmarcLoaderConnectionsByDomainId, - dmarcLoaderByKey, -} = require('../..') +const { dmarcLoaderConnectionsByDomainId, dmarcLoaderByKey } = require('../..') describe('when given the load dmarc connection function', () => { let query, drop, truncate, migrate, collections, user, domain, i18n diff --git a/api-js/src/loaders/organizations/__tests__/load-organization-connections-by-domain-id.test.js b/api-js/src/loaders/organizations/__tests__/load-organization-connections-by-domain-id.test.js index 31e588e08..4181718f7 100644 --- a/api-js/src/loaders/organizations/__tests__/load-organization-connections-by-domain-id.test.js +++ b/api-js/src/loaders/organizations/__tests__/load-organization-connections-by-domain-id.test.js @@ -9,10 +9,7 @@ const englishMessages = require('../../../locale/en/messages') const frenchMessages = require('../../../locale/fr/messages') const { makeMigrations } = require('../../../../migrations') const { cleanseInput } = require('../../../validators') -const { - orgLoaderConnectionArgsByDomainId, - orgLoaderByKey, -} = require('../..') +const { orgLoaderConnectionArgsByDomainId, orgLoaderByKey } = require('../..') describe('given the load organizations connection function', () => { let query, diff --git a/api-js/src/loaders/verified-domains/__tests__/load-verified-domain-connections.test.js b/api-js/src/loaders/verified-domains/__tests__/load-verified-domain-connections.test.js index 59c64e29d..542247cf3 100644 --- a/api-js/src/loaders/verified-domains/__tests__/load-verified-domain-connections.test.js +++ b/api-js/src/loaders/verified-domains/__tests__/load-verified-domain-connections.test.js @@ -8,10 +8,7 @@ const englishMessages = require('../../../locale/en/messages') const frenchMessages = require('../../../locale/fr/messages') const { makeMigrations } = require('../../../../migrations') const { cleanseInput } = require('../../../validators') -const { - verifiedDomainLoaderConnections, - domainLoaderByKey, -} = require('../..') +const { verifiedDomainLoaderConnections, domainLoaderByKey } = require('../..') const { toGlobalId } = require('graphql-relay') describe('given the load domain connection using org id function', () => { diff --git a/api-js/src/loaders/web-scan/__tests__/load-https-connections-by-domain-id.test.js b/api-js/src/loaders/web-scan/__tests__/load-https-connections-by-domain-id.test.js index 81a0ec738..725d2c92a 100644 --- a/api-js/src/loaders/web-scan/__tests__/load-https-connections-by-domain-id.test.js +++ b/api-js/src/loaders/web-scan/__tests__/load-https-connections-by-domain-id.test.js @@ -9,10 +9,7 @@ const englishMessages = require('../../../locale/en/messages') const frenchMessages = require('../../../locale/fr/messages') const { makeMigrations } = require('../../../../migrations') const { cleanseInput } = require('../../../validators') -const { - httpsLoaderConnectionsByDomainId, - httpsLoaderByKey, -} = require('../..') +const { httpsLoaderConnectionsByDomainId, httpsLoaderByKey } = require('../..') describe('given the load https connection function', () => { let query, drop, truncate, migrate, collections, user, domain, i18n diff --git a/api-js/src/mutations/user-affiliations/__tests__/remove-user-from-org.test.js b/api-js/src/mutations/user-affiliations/__tests__/remove-user-from-org.test.js index 2fe254b6a..81c805ec6 100644 --- a/api-js/src/mutations/user-affiliations/__tests__/remove-user-from-org.test.js +++ b/api-js/src/mutations/user-affiliations/__tests__/remove-user-from-org.test.js @@ -1574,11 +1574,7 @@ describe('removing a user from an organization', () => { }, ) - const error = [ - new GraphQLError( - 'todo', - ), - ] + const error = [new GraphQLError('todo')] expect(response.errors).toEqual(error) expect(consoleOutput).toEqual([ @@ -1641,11 +1637,7 @@ describe('removing a user from an organization', () => { }, ) - const error = [ - new GraphQLError( - 'todo', - ), - ] + const error = [new GraphQLError('todo')] expect(response.errors).toEqual(error) expect(consoleOutput).toEqual([ @@ -1708,11 +1700,7 @@ describe('removing a user from an organization', () => { }, ) - const error = [ - new GraphQLError( - 'todo', - ), - ] + const error = [new GraphQLError('todo')] expect(response.errors).toEqual(error) expect(consoleOutput).toEqual([ @@ -1775,11 +1763,7 @@ describe('removing a user from an organization', () => { }, ) - const error = [ - new GraphQLError( - 'todo', - ), - ] + const error = [new GraphQLError('todo')] expect(response.errors).toEqual(error) expect(consoleOutput).toEqual([ @@ -1842,11 +1826,7 @@ describe('removing a user from an organization', () => { }, ) - const error = [ - new GraphQLError( - 'todo', - ), - ] + const error = [new GraphQLError('todo')] expect(response.errors).toEqual(error) expect(consoleOutput).toEqual([ @@ -1910,11 +1890,7 @@ describe('removing a user from an organization', () => { }, ) - const error = [ - new GraphQLError( - 'todo', - ), - ] + const error = [new GraphQLError('todo')] expect(response.errors).toEqual(error) expect(consoleOutput).toEqual([ @@ -1984,11 +1960,7 @@ describe('removing a user from an organization', () => { }, ) - const error = [ - new GraphQLError( - 'todo', - ), - ] + const error = [new GraphQLError('todo')] expect(response.errors).toEqual(error) expect(consoleOutput).toEqual([ @@ -2061,11 +2033,7 @@ describe('removing a user from an organization', () => { }, ) - const error = [ - new GraphQLError( - 'todo', - ), - ] + const error = [new GraphQLError('todo')] expect(response.errors).toEqual(error) expect(consoleOutput).toEqual([ @@ -2126,11 +2094,7 @@ describe('removing a user from an organization', () => { }, ) - const error = [ - new GraphQLError( - 'todo', - ), - ] + const error = [new GraphQLError('todo')] expect(response.errors).toEqual(error) expect(consoleOutput).toEqual([ diff --git a/api-js/src/mutations/user-affiliations/remove-user-from-org.js b/api-js/src/mutations/user-affiliations/remove-user-from-org.js index fbc6239f6..d79ca8d98 100644 --- a/api-js/src/mutations/user-affiliations/remove-user-from-org.js +++ b/api-js/src/mutations/user-affiliations/remove-user-from-org.js @@ -155,7 +155,9 @@ const removeUserFromOrg = new mutationWithClientMutationId({ ) } - console.info(`User: ${userKey} successfully removed user: ${requestedUser._key} from org: ${requestedOrg._key}.`) + console.info( + `User: ${userKey} successfully removed user: ${requestedUser._key} from org: ${requestedOrg._key}.`, + ) return { status: i18n._(t`Successfully removed user from organization.`), diff --git a/api-js/src/mutations/user/send-phone-code.js b/api-js/src/mutations/user/send-phone-code.js index facb23b1a..b10cc6867 100644 --- a/api-js/src/mutations/user/send-phone-code.js +++ b/api-js/src/mutations/user/send-phone-code.js @@ -87,7 +87,7 @@ const sendPhoneCode = new mutationWithClientMutationId({ ) let encrypted = cipher.update(phoneNumber, 'utf8', 'hex') encrypted += cipher.final('hex') - + phoneDetails.phoneNumber = encrypted phoneDetails.tag = cipher.getAuthTag().toString('hex') diff --git a/api-js/src/mutations/user/update-user-profile.js b/api-js/src/mutations/user/update-user-profile.js index b18d1bb58..0d0174fc9 100644 --- a/api-js/src/mutations/user/update-user-profile.js +++ b/api-js/src/mutations/user/update-user-profile.js @@ -93,7 +93,7 @@ const updateUserProfile = new mutationWithClientMutationId({ 'aes-256-ccm', String(CIPHER_KEY), Buffer.from(updatedPhoneDetails.iv, 'hex'), - { authTagLength: 16}, + { authTagLength: 16 }, ) let encrypted = cipher.update(phoneNumber, 'utf8', 'hex') encrypted += cipher.final('hex') diff --git a/api-js/src/queries/domains/find-my-domains.js b/api-js/src/queries/domains/find-my-domains.js index 09527fdb8..4d93fba8f 100644 --- a/api-js/src/queries/domains/find-my-domains.js +++ b/api-js/src/queries/domains/find-my-domains.js @@ -10,7 +10,8 @@ const findMyDomains = { args: { ownership: { type: GraphQLBoolean, - description: 'Limit domains to those that belong to an organization that has ownership.', + description: + 'Limit domains to those that belong to an organization that has ownership.', }, ...connectionArgs, }, diff --git a/api-js/src/types/__tests__/dkim-connection.test.js b/api-js/src/types/__tests__/dkim-connection.test.js index c2cdb696a..bc40f7dfd 100644 --- a/api-js/src/types/__tests__/dkim-connection.test.js +++ b/api-js/src/types/__tests__/dkim-connection.test.js @@ -14,7 +14,7 @@ describe('given the dkim connection object', () => { describe('testing the totalCount resolver', () => { it('returns the resolved value', () => { const demoType = dkimConnection.connectionType.getFields() - + expect(demoType.totalCount.resolve({ totalCount: 1 })).toEqual(1) }) }) diff --git a/api-js/src/types/__tests__/dkim-results-connection.test.js b/api-js/src/types/__tests__/dkim-results-connection.test.js index d98bd64f0..62f6f1eed 100644 --- a/api-js/src/types/__tests__/dkim-results-connection.test.js +++ b/api-js/src/types/__tests__/dkim-results-connection.test.js @@ -14,7 +14,7 @@ describe('given the dkim result connection object', () => { describe('testing the totalCount resolver', () => { it('returns the resolved value', () => { const demoType = dkimResultConnection.connectionType.getFields() - + expect(demoType.totalCount.resolve({ totalCount: 1 })).toEqual(1) }) }) diff --git a/api-js/src/types/__tests__/domain.test.js b/api-js/src/types/__tests__/domain.test.js index f04ad0140..39b8a2be3 100644 --- a/api-js/src/types/__tests__/domain.test.js +++ b/api-js/src/types/__tests__/domain.test.js @@ -1,7 +1,12 @@ const { DB_PASS: rootPass, DB_URL: url } = process.env const { ArangoTools, dbNameFromFile } = require('arango-tools') -const { GraphQLNonNull, GraphQLID, GraphQLList, GraphQLString } = require('graphql') +const { + GraphQLNonNull, + GraphQLID, + GraphQLList, + GraphQLString, +} = require('graphql') const { toGlobalId } = require('graphql-relay') const { makeMigrations } = require('../../../migrations') diff --git a/api-js/src/types/__tests__/user-shared.test.js b/api-js/src/types/__tests__/user-shared.test.js index 2eb7154f0..e28997c4c 100644 --- a/api-js/src/types/__tests__/user-shared.test.js +++ b/api-js/src/types/__tests__/user-shared.test.js @@ -1,7 +1,4 @@ -const { - GraphQLNonNull, - GraphQLID, -} = require('graphql') +const { GraphQLNonNull, GraphQLID } = require('graphql') const { toGlobalId } = require('graphql-relay') const { GraphQLEmailAddress } = require('graphql-scalars') diff --git a/api-js/src/types/__tests__/verified-domain-connection.test.js b/api-js/src/types/__tests__/verified-domain-connection.test.js index 86542c108..d58836449 100644 --- a/api-js/src/types/__tests__/verified-domain-connection.test.js +++ b/api-js/src/types/__tests__/verified-domain-connection.test.js @@ -14,7 +14,7 @@ describe('given the verified domain connection object', () => { describe('testing the totalCount resolver', () => { it('returns the resolved value', () => { const demoType = verifiedDomainConnection.connectionType.getFields() - + expect(demoType.totalCount.resolve({ totalCount: 1 })).toEqual(1) }) }) diff --git a/api-js/src/types/__tests__/verified-organization-connection.test.js b/api-js/src/types/__tests__/verified-organization-connection.test.js index 6eb0d81ab..c9f1a72cd 100644 --- a/api-js/src/types/__tests__/verified-organization-connection.test.js +++ b/api-js/src/types/__tests__/verified-organization-connection.test.js @@ -14,7 +14,7 @@ describe('given the verified organization connection object', () => { describe('testing the totalCount resolver', () => { it('returns the resolved value', () => { const demoType = verifiedOrganizationConnection.connectionType.getFields() - + expect(demoType.totalCount.resolve({ totalCount: 1 })).toEqual(1) }) }) diff --git a/api-js/src/types/dmarc-report/detail-tables/__tests__/dkim-failure-table.test.js b/api-js/src/types/dmarc-report/detail-tables/__tests__/dkim-failure-table.test.js index 6832a8522..cfc2f9cef 100644 --- a/api-js/src/types/dmarc-report/detail-tables/__tests__/dkim-failure-table.test.js +++ b/api-js/src/types/dmarc-report/detail-tables/__tests__/dkim-failure-table.test.js @@ -88,9 +88,9 @@ describe('given the dkimFailureTable gql object', () => { it('returns resolved value', () => { const demoType = dkimFailureTableType.getFields() - expect( - demoType.dkimAligned.resolve({ dkimAligned: true }), - ).toEqual(true) + expect(demoType.dkimAligned.resolve({ dkimAligned: true })).toEqual( + true, + ) }) }) describe('testing the dkimDomains resolver', () => {