mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
add social media backend test
This commit is contained in:
parent
8847f071fd
commit
4c84a02f59
@ -40,6 +40,8 @@ export default {
|
||||
},
|
||||
)
|
||||
session.close()
|
||||
|
||||
return params
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -16,6 +16,14 @@ describe('SocialMedia', () => {
|
||||
}
|
||||
}
|
||||
`
|
||||
const mutationU = gql`
|
||||
mutation($id: ID!, $url: String!) {
|
||||
UpdateSocialMedia(id: $id, url: $url) {
|
||||
id
|
||||
url
|
||||
}
|
||||
}
|
||||
`
|
||||
const mutationD = gql`
|
||||
mutation($id: ID!) {
|
||||
DeleteSocialMedia(id: $id) {
|
||||
@ -75,6 +83,27 @@ describe('SocialMedia', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('updates social media', async () => {
|
||||
const creationVariables = {
|
||||
url: 'http://nsosp.org',
|
||||
}
|
||||
const { CreateSocialMedia } = await client.request(mutationC, creationVariables)
|
||||
const { id } = CreateSocialMedia
|
||||
const variables = {
|
||||
id,
|
||||
url: 'https://newurl.org',
|
||||
}
|
||||
const expected = {
|
||||
UpdateSocialMedia: {
|
||||
id: id,
|
||||
url: 'https://newurl.org',
|
||||
},
|
||||
}
|
||||
await expect(client.request(mutationU, variables)).resolves.toEqual(
|
||||
expect.objectContaining(expected),
|
||||
)
|
||||
})
|
||||
|
||||
it('deletes social media', async () => {
|
||||
const creationVariables = {
|
||||
url: 'http://nsosp.org',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user