Merge branch 'broken-front' into 'develop'

Broken front - CI checks to avoid it again

Closes #169

See merge request funkwhale/funkwhale!148
This commit is contained in:
Eliot Berriot 2018-04-20 17:37:35 +00:00
commit 9e05d23aee
8 changed files with 27 additions and 8 deletions

View File

@ -46,6 +46,7 @@ test_front:
script: script:
- yarn install - yarn install
- yarn run build | tee /dev/stderr | (! grep -i 'ERROR in')
- yarn run unit - yarn run unit
cache: cache:
key: "$CI_PROJECT_ID__front_dependencies" key: "$CI_PROJECT_ID__front_dependencies"
@ -70,7 +71,9 @@ build_front:
- yarn install - yarn install
- yarn run i18n-extract - yarn run i18n-extract
- yarn run i18n-compile - yarn run i18n-compile
- yarn run build # this is to ensure we don't have any errors in the output,
# cf https://code.eliotberriot.com/funkwhale/funkwhale/issues/169
- yarn run build | tee /dev/stderr | (! grep -i 'ERROR in')
cache: cache:
key: "$CI_PROJECT_ID__front_dependencies" key: "$CI_PROJECT_ID__front_dependencies"
paths: paths:

View File

@ -48,7 +48,7 @@
<div <div
v-if="track" v-if="track"
class="ui green icon basic small right floated button" class="ui green icon basic small right floated button"
:title="{{ $t('Add to this playlist') }}" :title="$t('Add to this playlist')"
@click="addToPlaylist(playlist.id)"> @click="addToPlaylist(playlist.id)">
<i class="plus icon"></i> {{ $t('Add track') }} <i class="plus icon"></i> {{ $t('Add track') }}
</div> </div>

View File

@ -0,0 +1,10 @@
import Username from '@/components/common/Username.vue'
import { render } from '../../utils'
describe('Username', () => {
it('displays username', () => {
const vm = render(Username, {username: 'Hello'})
expect(vm.$el.textContent).to.equal('Hello')
})
})

View File

@ -134,7 +134,7 @@ describe('store/auth', () => {
action: store.actions.login, action: store.actions.login,
payload: {credentials: credentials}, payload: {credentials: credentials},
expectedMutations: [ expectedMutations: [
{ type: 'token', payload: 'test' }, { type: 'token', payload: 'test' }
], ],
expectedActions: [ expectedActions: [
{ type: 'fetchProfile' } { type: 'fetchProfile' }
@ -183,7 +183,7 @@ describe('store/auth', () => {
], ],
expectedActions: [ expectedActions: [
{ type: 'favorites/fetch', payload: null, options: {root: true} }, { type: 'favorites/fetch', payload: null, options: {root: true} },
{ type: 'playlists/fetchOwn', payload: null, options: {root: true} }, { type: 'playlists/fetchOwn', payload: null, options: {root: true} }
] ]
}, done) }, done)
}) })

View File

@ -132,7 +132,7 @@ describe('store/player', () => {
testAction({ testAction({
action: store.actions.trackEnded, action: store.actions.trackEnded,
payload: {test: 'track'}, payload: {test: 'track'},
params: {rootState: {queue: {currentIndex:0, tracks: [1, 2]}}}, params: {rootState: {queue: {currentIndex: 0, tracks: [1, 2]}}},
expectedActions: [ expectedActions: [
{ type: 'trackListened', payload: {test: 'track'} }, { type: 'trackListened', payload: {test: 'track'} },
{ type: 'queue/next', payload: null, options: {root: true} } { type: 'queue/next', payload: null, options: {root: true} }
@ -143,7 +143,7 @@ describe('store/player', () => {
testAction({ testAction({
action: store.actions.trackEnded, action: store.actions.trackEnded,
payload: {test: 'track'}, payload: {test: 'track'},
params: {rootState: {queue: {currentIndex:1, tracks: [1, 2]}}}, params: {rootState: {queue: {currentIndex: 1, tracks: [1, 2]}}},
expectedActions: [ expectedActions: [
{ type: 'trackListened', payload: {test: 'track'} }, { type: 'trackListened', payload: {test: 'track'} },
{ type: 'radios/populateQueue', payload: null, options: {root: true} }, { type: 'radios/populateQueue', payload: null, options: {root: true} },

View File

@ -326,7 +326,7 @@ describe('store/queue', () => {
action: store.actions.shuffle, action: store.actions.shuffle,
params: {state: {currentIndex: 1, tracks: tracks}}, params: {state: {currentIndex: 1, tracks: tracks}},
expectedMutations: [ expectedMutations: [
{ type: 'player/currentTime', payload: 0, options: {root: true}}, { type: 'player/currentTime', payload: 0, options: {root: true} },
{ type: 'tracks', payload: [] } { type: 'tracks', payload: [] }
], ],
expectedActions: [ expectedActions: [

View File

@ -97,6 +97,5 @@ describe('store/radios', () => {
expectedActions: [] expectedActions: []
}, done) }, done)
}) })
}) })
}) })

View File

@ -1,4 +1,11 @@
// helper for testing action with expected mutations // helper for testing action with expected mutations
import Vue from 'vue'
export const render = (Component, propsData) => {
const Constructor = Vue.extend(Component)
return new Constructor({ propsData: propsData }).$mount()
}
export const testAction = ({action, payload, params, expectedMutations, expectedActions}, done) => { export const testAction = ({action, payload, params, expectedMutations, expectedActions}, done) => {
let mutationsCount = 0 let mutationsCount = 0
let actionsCount = 0 let actionsCount = 0