Skip to content

Commit f97f93f

Browse files
committed
test: replace sinon with jest
1 parent 1f22424 commit f97f93f

File tree

4 files changed

+8
-107
lines changed

4 files changed

+8
-107
lines changed

package-lock.json

Lines changed: 0 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"mkdirp": "^0.5.1",
5858
"rollup": "^0.51.8",
5959
"rollup-plugin-buble": "^0.18.0",
60-
"sinon": "^4.1.2",
6160
"uglify-js": "^3.1.10",
6261
"vue": "^2.5.9"
6362
},

test/collection.spec.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import sinon from 'sinon'
21
import Vuefire from '../src'
32
import {
43
db,
@@ -57,11 +56,11 @@ test('add properties', async () => {
5756
test('unbinds when the instance is destroyed', async () => {
5857
expect(vm._firestoreUnbinds).toBeTruthy()
5958
expect(vm.items).toEqual([])
60-
const spy = sinon.spy(vm._firestoreUnbinds, 'items')
59+
const spy = jest.spyOn(vm._firestoreUnbinds, 'items')
6160
expect(() => {
6261
vm.$destroy()
6362
}).not.toThrow()
64-
expect(spy.callCount).toBe(1)
63+
expect(spy).toHaveBeenCalled()
6564
expect(vm._firestoreUnbinds).toBe(null)
6665
await expect(async () => {
6766
await collection.add({ text: 'foo' })

test/unbind.spec.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import sinon from 'sinon'
21
import Vuefire from '../src'
32
import {
43
db,
@@ -33,23 +32,25 @@ beforeEach(async () => {
3332
})
3433

3534
test('manually unbinds a collection', async () => {
36-
const spy = sinon.spy(vm._firestoreUnbinds, 'items')
35+
const spy = jest.spyOn(vm._firestoreUnbinds, 'items')
3736
vm.$unbind('items')
38-
expect(spy.callCount).toBe(1)
37+
expect(spy).toHaveBeenCalled()
3938
expect(Object.keys(vm._firestoreUnbinds)).toEqual(['item'])
4039
expect(Object.keys(vm.$firestoreRefs)).toEqual(['item'])
4140
expect(vm.items).toEqual([])
4241
await collection.add({ text: 'foo' })
4342
expect(vm.items).toEqual([])
43+
spy.mockRestore()
4444
})
4545

4646
test('manually unbinds a document', async () => {
47-
const spy = sinon.spy(vm._firestoreUnbinds, 'item')
47+
const spy = jest.spyOn(vm._firestoreUnbinds, 'item')
4848
vm.$unbind('item')
49-
expect(spy.callCount).toBe(1)
49+
expect(spy).toHaveBeenCalled()
5050
expect(Object.keys(vm._firestoreUnbinds)).toEqual(['items'])
5151
expect(Object.keys(vm.$firestoreRefs)).toEqual(['items'])
5252
expect(vm.item).toEqual(null)
5353
await document.update({ foo: 'foo' })
5454
expect(vm.item).toEqual(null)
55+
spy.mockRestore()
5556
})

0 commit comments

Comments
 (0)