Skip to content

Commit

Permalink
eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ReadWriteError committed Mar 13, 2024
1 parent dd5b008 commit 0f8809b
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions tests/plugin-global.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('plugin - global', () => {
expect(history).toHaveLength(3)

const [first, second, third] = history

// 1 create
expect(first.version).toBe(0)
expect(first.op).toBe('create')
Expand All @@ -80,7 +80,7 @@ describe('plugin - global', () => {

expect(second.patch).toHaveLength(1)
expect(second.patch).toMatchObject([
{ op: 'add', path: '/groups/0', value: 'office' }
{ op: 'add', path: '/groups/0', value: 'office' },
])

// 3 update
Expand All @@ -94,20 +94,20 @@ describe('plugin - global', () => {

expect(third.patch).toHaveLength(1)
expect(third.patch).toMatchObject([
{ op: 'add', path: '/groups/1', value: 'school' }
{ op: 'add', path: '/groups/1', value: 'school' },
])

expect(em.emit).toHaveBeenCalledTimes(3)
expect(em.emit).toHaveBeenCalledWith(GLOBAL_CREATED, { doc: first.doc })
expect(em.emit).toHaveBeenCalledWith(GLOBAL_UPDATED, {
oldDoc: expect.objectContaining({ _id: product._id, name: 'paper', groups: [] }),
doc: expect.objectContaining({ _id: product._id, name: 'paper', groups: ['office'] }),
patch: second.patch
patch: second.patch,
})
expect(em.emit).toHaveBeenCalledWith(GLOBAL_UPDATED, {
oldDoc: expect.objectContaining({ _id: product._id, name: 'paper', groups: ['office'] }),
doc: expect.objectContaining({ _id: product._id, name: 'paper', groups: ['office', 'school'] }),
patch: third.patch
patch: third.patch,
})
})

Expand All @@ -116,18 +116,18 @@ describe('plugin - global', () => {
expect(product.name).toBe('paper')

await product.updateOne({
groups: ['office']
groups: ['office'],
}).exec()

await product.updateOne({
$push: { groups: 'school' }
$push: { groups: 'school' },
}).exec()

const history = await History.find({})
expect(history).toHaveLength(3)

const [first, second, third] = history

// 1 create
expect(first.version).toBe(0)
expect(first.op).toBe('create')
Expand All @@ -154,7 +154,7 @@ describe('plugin - global', () => {

expect(second.patch).toHaveLength(1)
expect(second.patch).toMatchObject([
{ op: 'add', path: '/groups/0', value: 'office' }
{ op: 'add', path: '/groups/0', value: 'office' },
])

// 3 update
Expand All @@ -168,20 +168,20 @@ describe('plugin - global', () => {

expect(third.patch).toHaveLength(1)
expect(third.patch).toMatchObject([
{ op: 'add', path: '/groups/1', value: 'school' }
{ op: 'add', path: '/groups/1', value: 'school' },
])

expect(em.emit).toHaveBeenCalledTimes(3)
expect(em.emit).toHaveBeenCalledWith(GLOBAL_CREATED, { doc: first.doc })
expect(em.emit).toHaveBeenCalledWith(GLOBAL_UPDATED, {
oldDoc: expect.objectContaining({ _id: product._id, name: 'paper', groups: [] }),
doc: expect.objectContaining({ _id: product._id, name: 'paper', groups: ['office'] }),
patch: second.patch
patch: second.patch,
})
expect(em.emit).toHaveBeenCalledWith(GLOBAL_UPDATED, {
oldDoc: expect.objectContaining({ _id: product._id, name: 'paper', groups: ['office'] }),
doc: expect.objectContaining({ _id: product._id, name: 'paper', groups: ['office', 'school'] }),
patch: third.patch
patch: third.patch,
})
})

Expand Down

0 comments on commit 0f8809b

Please sign in to comment.