Skip to content

Commit

Permalink
test: removed unneeded const
Browse files Browse the repository at this point in the history
  • Loading branch information
kouts committed May 17, 2021
1 parent 3af4e70 commit 5dee57b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 28 deletions.
21 changes: 7 additions & 14 deletions tests/unit/pathStore.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,61 +62,54 @@ describe('pathStore', () => {
wrapper.vm.$s.set('data', arr)
wrapper.vm.$s.pop('data')
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([1, 2, 3])
expect(dataOf(wrapper)).toEqual([1, 2, 3])
})

it('pushes an element into an array', async () => {
const arr = [1, 2, 3]
wrapper.vm.$s.set('data', arr)
wrapper.vm.$s.push('data', 4)
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([1, 2, 3, 4])
expect(dataOf(wrapper)).toEqual([1, 2, 3, 4])
})

it('reverses an an array', async () => {
const arr = [1, 2, 3]
wrapper.vm.$s.set('data', arr)
wrapper.vm.$s.reverse('data')
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([3, 2, 1])
expect(dataOf(wrapper)).toEqual([3, 2, 1])
})

it('removes the first element of an array', async () => {
const arr = [1, 2, 3, 4]
wrapper.vm.$s.set('data', arr)
wrapper.vm.$s.shift('data')
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([2, 3, 4])
expect(dataOf(wrapper)).toEqual([2, 3, 4])
})

it('sorts an array', async () => {
const arr = [2, 4, 1, 3]
wrapper.vm.$s.set('data', arr)
wrapper.vm.$s.sort('data')
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([1, 2, 3, 4])
expect(dataOf(wrapper)).toEqual([1, 2, 3, 4])
})

it('splices an array', async () => {
const arr = [1, 2, 3, 4]
wrapper.vm.$s.set('data', arr)
wrapper.vm.$s.splice('data', 0, 2)
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([3, 4])
expect(dataOf(wrapper)).toEqual([3, 4])
})

it('adds elements to the beginning of an array', async () => {
const arr = [3, 4]
wrapper.vm.$s.set('data', arr)
wrapper.vm.$s.unshift('data', 1, 2)
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([1, 2, 3, 4])
expect(dataOf(wrapper)).toEqual([1, 2, 3, 4])
})
})
21 changes: 7 additions & 14 deletions tests/unit/pathStoreVuexPlugin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,61 +63,54 @@ describe('pathStoreVuexPlugin', () => {
wrapper.vm.$store.set('data', arr)
wrapper.vm.$store.pop('data')
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([1, 2, 3])
expect(dataOf(wrapper)).toEqual([1, 2, 3])
})

it('pushes an element into an array', async () => {
const arr = [1, 2, 3]
wrapper.vm.$store.set('data', arr)
wrapper.vm.$store.push('data', 4)
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([1, 2, 3, 4])
expect(dataOf(wrapper)).toEqual([1, 2, 3, 4])
})

it('reverses an an array', async () => {
const arr = [1, 2, 3]
wrapper.vm.$store.set('data', arr)
wrapper.vm.$store.reverse('data')
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([3, 2, 1])
expect(dataOf(wrapper)).toEqual([3, 2, 1])
})

it('removes the first element of an array', async () => {
const arr = [1, 2, 3, 4]
wrapper.vm.$store.set('data', arr)
wrapper.vm.$store.shift('data')
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([2, 3, 4])
expect(dataOf(wrapper)).toEqual([2, 3, 4])
})

it('sorts an array', async () => {
const arr = [2, 4, 1, 3]
wrapper.vm.$store.set('data', arr)
wrapper.vm.$store.sort('data')
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([1, 2, 3, 4])
expect(dataOf(wrapper)).toEqual([1, 2, 3, 4])
})

it('splices an array', async () => {
const arr = [1, 2, 3, 4]
wrapper.vm.$store.set('data', arr)
wrapper.vm.$store.splice('data', 0, 2)
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([3, 4])
expect(dataOf(wrapper)).toEqual([3, 4])
})

it('adds elements to the beginning of an array', async () => {
const arr = [3, 4]
wrapper.vm.$store.set('data', arr)
wrapper.vm.$store.unshift('data', 1, 2)
await waitNT(wrapper.vm)
const data = dataOf(wrapper)
expect(data).toEqual([1, 2, 3, 4])
expect(dataOf(wrapper)).toEqual([1, 2, 3, 4])
})
})

0 comments on commit 5dee57b

Please sign in to comment.