mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Refactor it updates disabled test for Comment
This commit is contained in:
parent
5c06ba39e2
commit
3e7e240392
@ -151,6 +151,7 @@ describe('disable', () => {
|
||||
query($id: ID!) {
|
||||
Comment(id: $id) {
|
||||
id
|
||||
disabled
|
||||
disabledBy {
|
||||
id
|
||||
}
|
||||
@ -168,6 +169,25 @@ describe('disable', () => {
|
||||
})
|
||||
await expect(query({ query: commentQuery, variables })).resolves.toMatchObject(expected)
|
||||
})
|
||||
|
||||
it('updates .disabled on comment', async () => {
|
||||
const commentQuery = gql`
|
||||
query($id: ID!) {
|
||||
Comment(id: $id) {
|
||||
id
|
||||
disabled
|
||||
}
|
||||
}
|
||||
`
|
||||
const before = { data: { Comment: [{ id: 'comment-id', disabled: false }] } }
|
||||
const expected = { data: { Comment: [{ id: 'comment-id', disabled: true }] } }
|
||||
|
||||
await expect(query({ query: commentQuery, variables })).resolves.toMatchObject(before)
|
||||
await expect(mutate({ mutation, variables })).resolves.toMatchObject({
|
||||
data: { disable: 'comment-id' },
|
||||
})
|
||||
await expect(query({ query: commentQuery, variables })).resolves.toMatchObject(expected)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -182,41 +202,6 @@ describe('disable', () => {
|
||||
|
||||
// describe('as moderator', () => {
|
||||
|
||||
// describe('on a comment', () => {
|
||||
// beforeEach(async () => {
|
||||
// variables = {
|
||||
// id: 'c47',
|
||||
// }
|
||||
|
||||
//
|
||||
// createResource = async () => {
|
||||
// await factory.create('User', {
|
||||
// id: 'u45',
|
||||
// email: 'commenter@example.org',
|
||||
// password: '1234',
|
||||
// })
|
||||
// const asAuthenticatedUser = await factory.authenticateAs({
|
||||
// email: 'commenter@example.org',
|
||||
// password: '1234',
|
||||
// })
|
||||
// await asAuthenticatedUser.create('Post', createPostVariables)
|
||||
// await asAuthenticatedUser.create('Comment', createCommentVariables)
|
||||
// }
|
||||
// })
|
||||
|
||||
// it('updates .disabled on comment', async () => {
|
||||
// const before = { Comment: [{ id: 'c47', disabled: false }] }
|
||||
// const expected = { Comment: [{ id: 'c47', disabled: true }] }
|
||||
|
||||
// await setup()
|
||||
// await expect(client.request('{ Comment { id disabled } }')).resolves.toEqual(before)
|
||||
// await action()
|
||||
// await expect(
|
||||
// client.request('{ Comment(disabled: true) { id disabled } }'),
|
||||
// ).resolves.toEqual(expected)
|
||||
// })
|
||||
// })
|
||||
|
||||
// describe('on a post', () => {
|
||||
// beforeEach(async () => {
|
||||
// variables = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user