diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 217047794ba8c2974dd1fa69396674cd11aea726..b2078f1530e89cb13a339137eb269d3bf682c9f1 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 03e36ee8846e64c2da147e5cb5e66b0e97b1d94f..404948dc0793cfce4a9515bfde6b76c95afa17a9 100644 --- a/front/src/components/playlists/PlaylistModal.vue +++ b/front/src/components/playlists/PlaylistModal.vue @@ -48,7 +48,7 @@ <div v-if="track" 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)"> <i class="plus icon"></i> {{ $t('Add track') }} </div> 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 0000000000000000000000000000000000000000..1af4144ca858bb1c264d43cc602994569ce8fc8b --- /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 6b187f5c63f7019546214f10c0f59982fcbc60dc..3d175e9f9fa0e31b3b51b79314fe182e0516549c 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 b55fb010d08576bfe9e029cd6eb8e130af81570f..1e6c9b33a5fd3c2c43911e4c8ae26e78bd239558 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 5304d1d75ecf47eef6872907ae0728c071538f13..0df7608e75c5d3bdb03c0b99d51fb5d6a75f7f96 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 6de6b8dd94858f34ee07d522d1e3d2ab36185cc0..3a8c48f04ec942ee8ecf8d71c8a64a4e009987ab 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 233ee982e5221e0997da8bd29d33cfac17a113e3..6471fc97f710385ff20dcfe2fdd4ee9ac7b9ec36 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