Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ describe('given the load affiliations by org id function', () => {
await affiliationLoader({ orgId: org._id, ...connectionArgs })
} catch (err) {
expect(err).toEqual(
new Error('Unable to query affiliations. Please try again.'),
new Error('Unable to query affiliation(s). Please try again.'),
)
}

Expand Down Expand Up @@ -870,7 +870,7 @@ describe('given the load affiliations by org id function', () => {
await affiliationLoader({ orgId: org._id, ...connectionArgs })
} catch (err) {
expect(err).toEqual(
new Error('Unable to load affiliations. Please try again.'),
new Error('Unable to load affiliation(s). Please try again.'),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4403,7 +4403,7 @@ describe('given the load affiliations by user id function', () => {
})
} catch (err) {
expect(err).toEqual(
new Error('Unable to query affiliations. Please try again.'),
new Error('Unable to query affiliation(s). Please try again.'),
)
}

Expand Down Expand Up @@ -4441,7 +4441,7 @@ describe('given the load affiliations by user id function', () => {
})
} catch (err) {
expect(err).toEqual(
new Error('Unable to load affiliations. Please try again.'),
new Error('Unable to load affiliation(s). Please try again.'),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ export const affiliationConnectionLoaderByOrgId = (
console.error(
`Database error occurred while user: ${userKey} was trying to query affiliations in affiliationConnectionLoaderByOrgId, error: ${err}`,
)
throw new Error(i18n._(t`Unable to query affiliations. Please try again.`))
throw new Error(
i18n._(t`Unable to query affiliation(s). Please try again.`),
)
}

let filteredAffiliations
Expand All @@ -228,7 +230,7 @@ export const affiliationConnectionLoaderByOrgId = (
console.error(
`Cursor error occurred while user: ${userKey} was trying to gather affiliations in affiliationConnectionLoaderByOrgId, error: ${err}`,
)
throw new Error(i18n._(t`Unable to load affiliations. Please try again.`))
throw new Error(i18n._(t`Unable to load affiliation(s). Please try again.`))
}

if (filteredAffiliations.affiliations.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,9 @@ export const affiliationConnectionLoaderByUserId = (
console.error(
`Database error occurred while user: ${userKey} was trying to query affiliations in affiliationConnectionLoaderByUserId, error: ${err}`,
)
throw new Error(i18n._(t`Unable to query affiliations. Please try again.`))
throw new Error(
i18n._(t`Unable to query affiliation(s). Please try again.`),
)
}

let filteredAffiliations
Expand All @@ -409,7 +411,7 @@ export const affiliationConnectionLoaderByUserId = (
console.error(
`Cursor error occurred while user: ${userKey} was trying to gather affiliations in affiliationConnectionLoaderByUserId, error: ${err}`,
)
throw new Error(i18n._(t`Unable to load affiliations. Please try again.`))
throw new Error(i18n._(t`Unable to load affiliation(s). Please try again.`))
}

if (filteredAffiliations.affiliations.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1072,9 +1072,7 @@ describe('invite user to org', () => {
)

const error = [
new GraphQLError(
'Unable to invite yourself to an org. Please try again.',
),
new GraphQLError('Unable to invite yourself to an org.'),
]

expect(response.errors).toEqual(error)
Expand Down Expand Up @@ -1143,7 +1141,7 @@ describe('invite user to org', () => {
)

const error = [
new GraphQLError('Unable to invite user. Please try again.'),
new GraphQLError('Unable to invite user to unknown organization.'),
]

expect(response.errors).toEqual(error)
Expand Down Expand Up @@ -1237,7 +1235,9 @@ describe('invite user to org', () => {
)

const error = [
new GraphQLError('Unable to invite user. Please try again.'),
new GraphQLError(
'Permission Denied: Please contact organization admin for help with user invitations.',
),
]

expect(response.errors).toEqual(error)
Expand Down Expand Up @@ -1335,7 +1335,9 @@ describe('invite user to org', () => {
)

const error = [
new GraphQLError('Unable to invite user. Please try again.'),
new GraphQLError(
'Permission Denied: Please contact organization admin for help with user invitations.',
),
]

expect(response.errors).toEqual(error)
Expand Down Expand Up @@ -1433,7 +1435,9 @@ describe('invite user to org', () => {
)

const error = [
new GraphQLError('Unable to invite user. Please try again.'),
new GraphQLError(
'Permission Denied: Please contact organization admin for help with user invitations.',
),
]

expect(response.errors).toEqual(error)
Expand Down Expand Up @@ -1551,7 +1555,9 @@ describe('invite user to org', () => {
)

const error = [
new GraphQLError('Unable to invite user. Please try again.'),
new GraphQLError(
'Unable to add user to organization. Please try again.',
),
]

expect(response.errors).toEqual(error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ describe('removing a user from an organization', () => {

const error = [
new GraphQLError(
'Unable to remove user from organization. Please try again.',
'Unable to remove user from unknown organization.',
),
]

Expand Down Expand Up @@ -654,7 +654,7 @@ describe('removing a user from an organization', () => {

const error = [
new GraphQLError(
'Unable to remove user from organization. Please try again.',
'Permission Denied: Please contact organization admin for help with removing users.',
),
]

Expand Down Expand Up @@ -721,7 +721,7 @@ describe('removing a user from an organization', () => {

const error = [
new GraphQLError(
'Unable to remove user from organization. Please try again.',
'Unable to remove a user that already does not belong to this organization.',
),
]

Expand Down Expand Up @@ -788,7 +788,7 @@ describe('removing a user from an organization', () => {

const error = [
new GraphQLError(
'Unable to remove user from organization. Please try again.',
'Permission Denied: Please contact organization admin for help with removing users.',
),
]

Expand Down Expand Up @@ -854,9 +854,7 @@ describe('removing a user from an organization', () => {
)

const error = [
new GraphQLError(
'Unable to remove user from organization. Please try again.',
),
new GraphQLError('Unable to remove user from organization.'),
]

expect(response.errors).toEqual(error)
Expand Down Expand Up @@ -923,7 +921,7 @@ describe('removing a user from an organization', () => {

const error = [
new GraphQLError(
'Unable to remove user from organization. Please try again.',
'Unable to remove unknown user from organization.',
),
]

Expand Down Expand Up @@ -997,7 +995,7 @@ describe('removing a user from an organization', () => {

const error = [
new GraphQLError(
'Unable to remove user from organization. Please try again.',
'Unable to remove user from this organization. Please try again.',
),
]

Expand Down
46 changes: 23 additions & 23 deletions api-js/src/affiliation/mutations/__tests__/update-user-role.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -581,11 +581,7 @@ describe('update a users role', () => {
},
)

const error = [
new GraphQLError(
'Unable to update your own role. Please try again.',
),
]
const error = [new GraphQLError('Unable to update your own role.')]

expect(response.errors).toEqual(error)
expect(consoleOutput).toEqual([
Expand Down Expand Up @@ -636,7 +632,7 @@ describe('update a users role', () => {
)

const error = [
new GraphQLError('Unable to update users role. Please try again.'),
new GraphQLError(`Unable to update role: user unknown.`),
]

expect(response.errors).toEqual(error)
Expand Down Expand Up @@ -688,7 +684,7 @@ describe('update a users role', () => {
)

const error = [
new GraphQLError('Unable to update users role. Please try again.'),
new GraphQLError(`Unable to update role: organization unknown.`),
]

expect(response.errors).toEqual(error)
Expand Down Expand Up @@ -747,7 +743,9 @@ describe('update a users role', () => {
)

const error = [
new GraphQLError('Unable to update users role. Please try again.'),
new GraphQLError(
'Permission Denied: Please contact organization admin for help with user role changes.',
),
]

expect(response.errors).toEqual(error)
Expand Down Expand Up @@ -832,7 +830,9 @@ describe('update a users role', () => {
)

const error = [
new GraphQLError('Unable to update users role. Please try again.'),
new GraphQLError(
'Permission Denied: Please contact organization admin for help with user role changes.',
),
]

expect(response.errors).toEqual(error)
Expand Down Expand Up @@ -892,7 +892,7 @@ describe('update a users role', () => {

const error = [
new GraphQLError(
'Unable to update users role. Please invite user to the organization.',
'Unable to update role: user does not belong to organization.',
),
]

Expand Down Expand Up @@ -963,7 +963,7 @@ describe('update a users role', () => {

const error = [
new GraphQLError(
'Unable to update users role. Please try again.',
`Permission Denied: Please contact organization admin for help with updating user roles.`,
),
]

Expand Down Expand Up @@ -1034,7 +1034,7 @@ describe('update a users role', () => {

const error = [
new GraphQLError(
'Unable to update users role. Please try again.',
`Permission Denied: Please contact organization admin for help with updating user roles.`,
),
]

Expand Down Expand Up @@ -1106,7 +1106,7 @@ describe('update a users role', () => {

const error = [
new GraphQLError(
'Unable to update users role. Please try again.',
`Permission Denied: Please contact organization admin for help with updating user roles.`,
),
]

Expand Down Expand Up @@ -1175,7 +1175,7 @@ describe('update a users role', () => {

const error = [
new GraphQLError(
'Unable to update users role. Please try again.',
`Permission Denied: Please contact organization admin for help with updating user roles.`,
),
]

Expand Down Expand Up @@ -1306,12 +1306,12 @@ describe('update a users role', () => {
)

const error = [
new GraphQLError('Unable to update users role. Please try again.'),
new GraphQLError(`Unable to update user's role. Please try again.`),
]

expect(response.errors).toEqual(error)
expect(consoleOutput).toEqual([
`Database error occurred when user: ${user._key} attempted to update a users: ${secondaryUser._key} role, error: Error: Database error occurred.`,
`Database error occurred when user: ${user._key} attempted to update a user's: ${secondaryUser._key} role, error: Error: Database error occurred.`,
])
})
})
Expand Down Expand Up @@ -1427,12 +1427,12 @@ describe('update a users role', () => {
)

const error = [
new GraphQLError('Unable to update users role. Please try again.'),
new GraphQLError(`Unable to update user's role. Please try again.`),
]

expect(response.errors).toEqual(error)
expect(consoleOutput).toEqual([
`Transaction step error occurred when user: ${user._key} attempted to update a users: ${secondaryUser._key} role, error: Error: Transaction error occurred.`,
`Transaction step error occurred when user: ${user._key} attempted to update a user's: ${secondaryUser._key} role, error: Error: Transaction error occurred.`,
])
})
})
Expand Down Expand Up @@ -1492,12 +1492,12 @@ describe('update a users role', () => {
)

const error = [
new GraphQLError('Unable to update users role. Please try again.'),
new GraphQLError(`Unable to update user's role. Please try again.`),
]

expect(response.errors).toEqual(error)
expect(consoleOutput).toEqual([
`Transaction commit error occurred when user: ${user._key} attempted to update a users: ${secondaryUser._key} role, error: Error: Transaction error occurred.`,
`Transaction commit error occurred when user: ${user._key} attempted to update a user's: ${secondaryUser._key} role, error: Error: Transaction error occurred.`,
])
})
})
Expand Down Expand Up @@ -2691,7 +2691,7 @@ describe('update a users role', () => {

expect(response.errors).toEqual(error)
expect(consoleOutput).toEqual([
`Database error occurred when user: ${user._key} attempted to update a users: ${secondaryUser._key} role, error: Error: Database error occurred.`,
`Database error occurred when user: ${user._key} attempted to update a user's: ${secondaryUser._key} role, error: Error: Database error occurred.`,
])
})
})
Expand Down Expand Up @@ -2810,7 +2810,7 @@ describe('update a users role', () => {

expect(response.errors).toEqual(error)
expect(consoleOutput).toEqual([
`Transaction step error occurred when user: ${user._key} attempted to update a users: ${secondaryUser._key} role, error: Error: Transaction error occurred.`,
`Transaction step error occurred when user: ${user._key} attempted to update a user's: ${secondaryUser._key} role, error: Error: Transaction error occurred.`,
])
})
})
Expand Down Expand Up @@ -2873,7 +2873,7 @@ describe('update a users role', () => {

expect(response.errors).toEqual(error)
expect(consoleOutput).toEqual([
`Transaction commit error occurred when user: ${user._key} attempted to update a users: ${secondaryUser._key} role, error: Error: Transaction error occurred.`,
`Transaction commit error occurred when user: ${user._key} attempted to update a user's: ${secondaryUser._key} role, error: Error: Transaction error occurred.`,
])
})
})
Expand Down
Loading