mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Don't expose termsAndConditionsAgreedAt
1. Don't expose `termsAndConditionsAgreedAt` as input param, because of ..why? 2. Make the `termsAndConditionsAgreedVersion` a *required* input param for `SignupVerification`. If new users register, they have to confirm the terms and conditions. I added another test to check what happens if the user sends `null`. 3. Sorry @ogerly for confusing you with my review here: https://github.com/Human-Connection/Human-Connection/pull/1556#pullrequestreview-287516516 What I meant is that we want to simulate a user with no `termsAndConditionsAgreedVersion`. But of course the `variables` must have it set when you run the mutations. Now we have the exclamation mark in the input param, see point 1 ☝️
This commit is contained in:
parent
8fa42ea6ea
commit
f3c31aed28
@ -62,7 +62,7 @@ describe('CreateInvitationCode', () => {
|
||||
name: 'Inviter',
|
||||
email: 'inviter@example.org',
|
||||
password: '1234',
|
||||
termsAndConditionsAgreedVersion: '0.0.1',
|
||||
termsAndConditionsAgreedVersion: null,
|
||||
})
|
||||
authenticatedUser = await user.toJson()
|
||||
})
|
||||
@ -352,8 +352,7 @@ describe('SignupVerification', () => {
|
||||
name: 'John Doe',
|
||||
password: '123',
|
||||
email: 'john@example.org',
|
||||
termsAndConditionsAgreedVersion: null,
|
||||
termsAndConditionsAgreedAt: null,
|
||||
termsAndConditionsAgreedVersion: '0.1.0',
|
||||
}
|
||||
})
|
||||
|
||||
@ -446,6 +445,16 @@ describe('SignupVerification', () => {
|
||||
expect(emails).toHaveLength(1)
|
||||
})
|
||||
|
||||
it('updates termsAndConditionsAgreedVersion', async () => {
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject({
|
||||
data: {
|
||||
SignupVerification: expect.objectContaining({
|
||||
termsAndConditionsAgreedVersion: '0.1.0',
|
||||
}),
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
it('updates termsAndConditionsAgreedAt', async () => {
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject({
|
||||
data: {
|
||||
@ -456,6 +465,18 @@ describe('SignupVerification', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('rejects if version of terms and conditions is missing', async () => {
|
||||
variables = { ...variables, termsAndConditionsAgreedVersion: null }
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject({
|
||||
errors: [
|
||||
{
|
||||
message:
|
||||
'Variable "$termsAndConditionsAgreedVersion" of non-null type "String!" must not be null.',
|
||||
},
|
||||
],
|
||||
})
|
||||
})
|
||||
|
||||
it('rejects if version of terms and conditions has wrong format', async () => {
|
||||
variables = { ...variables, termsAndConditionsAgreedVersion: 'invalid version format' }
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject({
|
||||
|
||||
@ -18,7 +18,6 @@ type Mutation {
|
||||
avatarUpload: Upload
|
||||
locationName: String
|
||||
about: String
|
||||
termsAndConditionsAgreedVersion: String
|
||||
termsAndConditionsAgreedAt: String
|
||||
termsAndConditionsAgreedVersion: String!
|
||||
): User
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user