mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Follow @mattwr18's suggestions
This commit is contained in:
parent
0b3bbb1f14
commit
7b44a87e3b
@ -219,7 +219,7 @@ describe('given some notifications', () => {
|
||||
})
|
||||
|
||||
describe('if a resource gets deleted', () => {
|
||||
beforeEach(async () => {
|
||||
const deletePostAction = async () => {
|
||||
authenticatedUser = await author.toJson()
|
||||
const deletePostMutation = gql`
|
||||
mutation($id: ID!) {
|
||||
@ -233,13 +233,18 @@ describe('given some notifications', () => {
|
||||
mutate({ mutation: deletePostMutation, variables: { id: 'p3' } }),
|
||||
).resolves.toMatchObject({ data: { DeletePost: { id: 'p3', deleted: true } } })
|
||||
authenticatedUser = await user.toJson()
|
||||
})
|
||||
}
|
||||
|
||||
it('reduces notifications list', async () => {
|
||||
const expected = expect.objectContaining({ data: { notifications: [] } })
|
||||
await expect(
|
||||
query({ query: notificationQuery, variables: { ...variables, read: false } }),
|
||||
).resolves.toEqual(expected)
|
||||
).resolves.toMatchObject({
|
||||
data: { notifications: [expect.any(Object), expect.any(Object)] },
|
||||
})
|
||||
await deletePostAction()
|
||||
await expect(
|
||||
query({ query: notificationQuery, variables: { ...variables, read: false } }),
|
||||
).resolves.toMatchObject({ data: { notifications: [] } })
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -17,7 +17,7 @@ export default function create() {
|
||||
let { post, postId } = args
|
||||
delete args.post
|
||||
delete args.postId
|
||||
if (post && post) throw new Error('You provided both post and postId')
|
||||
if (post && postId) throw new Error('You provided both post and postId')
|
||||
if (postId) post = await neodeInstance.find('Post', postId)
|
||||
post = post || (await factoryInstance.create('Post'))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user