mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-06 09:49:55 +02:00
Store for fetching user playlists
This commit is contained in:
parent
15300e255c
commit
a34b1afd6c
5 changed files with 65 additions and 1 deletions
36
front/test/unit/specs/store/playlists.spec.js
Normal file
36
front/test/unit/specs/store/playlists.spec.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
var sinon = require('sinon')
|
||||
import moxios from 'moxios'
|
||||
import store from '@/store/playlists'
|
||||
|
||||
import { testAction } from '../../utils'
|
||||
|
||||
describe('store/playlists', () => {
|
||||
var sandbox
|
||||
|
||||
beforeEach(function () {
|
||||
sandbox = sinon.sandbox.create()
|
||||
moxios.install()
|
||||
})
|
||||
afterEach(function () {
|
||||
sandbox.restore()
|
||||
moxios.uninstall()
|
||||
})
|
||||
|
||||
describe('mutations', () => {
|
||||
it('set playlists', () => {
|
||||
const state = { playlists: [] }
|
||||
store.mutations.playlists(state, [{id: 1, name: 'test'}])
|
||||
expect(state.playlists).to.deep.equal([{id: 1, name: 'test'}])
|
||||
})
|
||||
})
|
||||
describe('actions', () => {
|
||||
it('fetchOwn does nothing with no user', (done) => {
|
||||
testAction({
|
||||
action: store.actions.fetchOwn,
|
||||
payload: null,
|
||||
params: {state: { playlists: [] }, rootState: {auth: {profile: {}}}},
|
||||
expectedMutations: []
|
||||
}, done)
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue