mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Refactor disable post updates disabledBy
This commit is contained in:
parent
84c1d8ef25
commit
e109b5f6b1
@ -179,11 +179,35 @@ describe('disable', () => {
|
||||
id: 'sample-post-id',
|
||||
})
|
||||
})
|
||||
|
||||
const postQuery = gql`
|
||||
query($id: ID) {
|
||||
Post(id: $id) {
|
||||
id
|
||||
disabledBy {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
it('returns disabled resource id', async () => {
|
||||
variables = { id: 'sample-post-id' }
|
||||
const expected = { data: { disable: 'sample-post-id' } }
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject(expected)
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject({
|
||||
data: { disable: 'sample-post-id' },
|
||||
})
|
||||
})
|
||||
|
||||
it.only('changes .disabledBy', async () => {
|
||||
variables = { id: 'sample-post-id' }
|
||||
const before = { data: { Post: [{ id: 'sample-post-id', disabledBy: null }] } }
|
||||
const expected = {
|
||||
data: { Post: [{ id: 'sample-post-id', disabledBy: { id: 'moderator-id' } }] },
|
||||
}
|
||||
|
||||
await expect(query({ query: postQuery, variables })).resolves.toMatchObject(before)
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject({
|
||||
data: { disable: 'sample-post-id' },
|
||||
})
|
||||
await expect(query({ query: postQuery, variables })).resolves.toMatchObject(expected)
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -213,12 +237,6 @@ describe('disable', () => {
|
||||
// }
|
||||
// })
|
||||
|
||||
// it('returns disabled resource id', async () => {
|
||||
// const expected = { disable: 'p9' }
|
||||
// await setup()
|
||||
// await expect(action()).resolves.toEqual(expected)
|
||||
// })
|
||||
|
||||
// it('changes .disabledBy', async () => {
|
||||
// const before = { Post: [{ id: 'p9', disabledBy: null }] }
|
||||
// const expected = { Post: [{ id: 'p9', disabledBy: { id: 'u7' } }] }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user