Skip to content

Commit

Permalink
tests: move all unit tests into unit folders
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasHirt committed Jun 14, 2021
1 parent cf81c85 commit cc54331
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getParentPaths } from '../../src/helpers/path'
import { getParentPaths } from '../../../src/helpers/path'

describe('build an array of parent paths from a provided path', () => {
it('should return an empty array on an empty path', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { buildSharedResource } from '../../src/helpers/resources'
import { buildSharedResource } from '../../../src/helpers/resources'

describe('buildSharedResource', () => {
const resourceFactory = (incomingShares = false) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAvatarSrc } from '../../src/helpers/user'
import { getAvatarSrc } from '../../../src/helpers/user'

describe('getAvatarSrc', () => {
it('throws an error', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { mount, createLocalVue, config } from '@vue/test-utils'
import Vuex from 'vuex'
import OwnCloud from 'owncloud-sdk'
import SharedWithMe from '../../src/views/SharedWithMe'
import SharedWithMe from '../../../src/views/SharedWithMe'
import { createStore } from 'vuex-extensions'
import DesignSystem from 'owncloud-design-system'

Expand Down Expand Up @@ -39,19 +39,22 @@ export const store = createStore(Vuex.Store, {
modules: {
Files: {
state: {
resource: null
resource: null,
currentPage: 1
},
getters: {
selectedFiles: () => [],
activeFiles: () => [createFile({ id: 1 }), createFile({ id: 2, status: 2 })],
activeFilesCount: () => ({ files: 0, folders: 1 }),
inProgress: () => [null],
highlightedFile: () => null
highlightedFile: () => null,
paginationLength: () => 3
},
mutations: {
UPDATE_RESOURCE: (state, resource) => {
state.resource = resource
}
},
UPDATE_CURRENT_PAGE: () => {}
},
namespaced: true
}
Expand All @@ -73,7 +76,7 @@ export const wrapper = mount(
}
)

jest.mock('../../src/helpers/resources', () => ({
jest.mock('../../../src/helpers/resources', () => ({
buildSharedResource: jest.fn(share => share)
}))

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { config, createLocalVue, mount, shallowMount } from '@vue/test-utils'
import { Store } from 'vuex-mock-store'
import Notifications from 'web-runtime/src/components/Notifications.vue'
import stubs from '../../../../tests/unit/stubs'
import stubs from '../../../../../tests/unit/stubs'
import DesignSystem from 'owncloud-design-system'
const localVue = createLocalVue()
localVue.use(DesignSystem)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { shallowMount, createLocalVue } from '@vue/test-utils'
import Vuex from 'vuex'
import TopBar from 'web-runtime/src/components/TopBar.vue'
import stubs from '../../../../tests/unit/stubs'
import axe from '../../../../tests/unit/helper/axe'
import stubs from '../../../../../tests/unit/stubs'
import axe from '../../../../../tests/unit/helper/axe'

const localVue = createLocalVue()
localVue.use(Vuex)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { shallowMount, createLocalVue, mount } from '@vue/test-utils'
import Vuex from 'vuex'
import { Store } from 'vuex-mock-store'
import UserMenu from 'web-runtime/src/components/UserMenu.vue'
import stubs from '../../../../tests/unit/stubs'
import stubs from '../../../../../tests/unit/stubs'
import DesignSystem from 'owncloud-design-system'

const localVue = createLocalVue()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createLocalVue, shallowMount } from '@vue/test-utils'
import focusMixin from '../../src/mixins/focusMixin'
import focusMixin from '../../../src/mixins/focusMixin'

const localVue = createLocalVue()
localVue.mixin(focusMixin)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createLocalVue, shallowMount } from '@vue/test-utils'
import lifecycleMixin from '../../src/mixins/lifecycleMixin'
import lifecycleMixin from '../../../src/mixins/lifecycleMixin'

const localVue = createLocalVue()
localVue.mixin(lifecycleMixin)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import Vue from 'vue'
import Vuex from 'vuex'
import { createStore } from 'vuex-extensions'

import { loadTheme } from 'web-runtime/src/helpers/theme'
import store from 'web-runtime/src/store'
import Store from 'web-runtime/src/store'
import { keysDeep } from 'web-pkg/src/utils/object'
import get from 'lodash-es/get'
import difference from 'lodash-es/difference'

describe('config theme bootstrap', () => {
Vue.use(Vuex)

const store = createStore(Vuex.Store, { ...Store })

const initialStoreTheme = { ...store.getters.configuration.theme }

beforeEach(() => {
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/config/jest.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@ try {
} catch (error) {}

config.mocks = {
$gettext: str => str
$gettext: str => str,
$route: {
params: {},
query: {},
name: '',
path: ''
}
}

0 comments on commit cc54331

Please sign in to comment.