diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 217047794..b2078f153 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,6 +46,7 @@ test_front: script: - yarn install + - yarn run build | tee /dev/stderr | (! grep -i 'ERROR in') - yarn run unit cache: key: "$CI_PROJECT_ID__front_dependencies" @@ -70,7 +71,9 @@ build_front: - yarn install - yarn run i18n-extract - 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: key: "$CI_PROJECT_ID__front_dependencies" paths: diff --git a/front/src/components/playlists/PlaylistModal.vue b/front/src/components/playlists/PlaylistModal.vue index 03e36ee88..404948dc0 100644 --- a/front/src/components/playlists/PlaylistModal.vue +++ b/front/src/components/playlists/PlaylistModal.vue @@ -48,7 +48,7 @@
{{ $t('Add track') }}
diff --git a/front/test/unit/specs/components/common.spec.js b/front/test/unit/specs/components/common.spec.js new file mode 100644 index 000000000..1af4144ca --- /dev/null +++ b/front/test/unit/specs/components/common.spec.js @@ -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') + }) +}) diff --git a/front/test/unit/specs/store/auth.spec.js b/front/test/unit/specs/store/auth.spec.js index 6b187f5c6..3d175e9f9 100644 --- a/front/test/unit/specs/store/auth.spec.js +++ b/front/test/unit/specs/store/auth.spec.js @@ -134,7 +134,7 @@ describe('store/auth', () => { action: store.actions.login, payload: {credentials: credentials}, expectedMutations: [ - { type: 'token', payload: 'test' }, + { type: 'token', payload: 'test' } ], expectedActions: [ { type: 'fetchProfile' } @@ -183,7 +183,7 @@ describe('store/auth', () => { ], expectedActions: [ { 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) }) diff --git a/front/test/unit/specs/store/player.spec.js b/front/test/unit/specs/store/player.spec.js index b55fb010d..1e6c9b33a 100644 --- a/front/test/unit/specs/store/player.spec.js +++ b/front/test/unit/specs/store/player.spec.js @@ -132,7 +132,7 @@ describe('store/player', () => { testAction({ action: store.actions.trackEnded, payload: {test: 'track'}, - params: {rootState: {queue: {currentIndex:0, tracks: [1, 2]}}}, + params: {rootState: {queue: {currentIndex: 0, tracks: [1, 2]}}}, expectedActions: [ { type: 'trackListened', payload: {test: 'track'} }, { type: 'queue/next', payload: null, options: {root: true} } @@ -143,7 +143,7 @@ describe('store/player', () => { testAction({ action: store.actions.trackEnded, payload: {test: 'track'}, - params: {rootState: {queue: {currentIndex:1, tracks: [1, 2]}}}, + params: {rootState: {queue: {currentIndex: 1, tracks: [1, 2]}}}, expectedActions: [ { type: 'trackListened', payload: {test: 'track'} }, { type: 'radios/populateQueue', payload: null, options: {root: true} }, diff --git a/front/test/unit/specs/store/queue.spec.js b/front/test/unit/specs/store/queue.spec.js index 5304d1d75..0df7608e7 100644 --- a/front/test/unit/specs/store/queue.spec.js +++ b/front/test/unit/specs/store/queue.spec.js @@ -326,7 +326,7 @@ describe('store/queue', () => { action: store.actions.shuffle, params: {state: {currentIndex: 1, tracks: tracks}}, expectedMutations: [ - { type: 'player/currentTime', payload: 0, options: {root: true}}, + { type: 'player/currentTime', payload: 0, options: {root: true} }, { type: 'tracks', payload: [] } ], expectedActions: [ diff --git a/front/test/unit/specs/store/radios.spec.js b/front/test/unit/specs/store/radios.spec.js index 6de6b8dd9..3a8c48f04 100644 --- a/front/test/unit/specs/store/radios.spec.js +++ b/front/test/unit/specs/store/radios.spec.js @@ -97,6 +97,5 @@ describe('store/radios', () => { expectedActions: [] }, done) }) - }) }) diff --git a/front/test/unit/utils.js b/front/test/unit/utils.js index 233ee982e..6471fc97f 100644 --- a/front/test/unit/utils.js +++ b/front/test/unit/utils.js @@ -1,4 +1,11 @@ // 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) => { let mutationsCount = 0 let actionsCount = 0