Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
remko48 committed Aug 7, 2024
1 parent 98d2d45 commit 085107e
Show file tree
Hide file tree
Showing 25 changed files with 626 additions and 629 deletions.
4 changes: 2 additions & 2 deletions src/entities/catalogi/catalogi.mock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Catalogi } from './catalogi';
import { TCatalogi } from './catalogi.types';
import { Catalogi } from './catalogi'
import { TCatalogi } from './catalogi.types'

export const mockCatalogiData = (): TCatalogi[] => [
{
Expand Down
4 changes: 2 additions & 2 deletions src/entities/catalogi/catalogi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SafeParseReturnType, z } from 'zod';
import { TCatalogi } from './catalogi.types';
import { SafeParseReturnType, z } from 'zod'
import { TCatalogi } from './catalogi.types'

export class Catalogi implements TCatalogi {

Expand Down
17 changes: 8 additions & 9 deletions src/entities/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable import/export */
export * from './attachment/index.js';
export * from './catalogi/index.js';
export * from './configuration/index.js';
export * from './listing/index.js';
export * from './metadata/index.js';
export * from './organisation/index.js';
export * from './publication/index.js';
export * from './theme/index.js';

export * from './attachment/index.js'
export * from './catalogi/index.js'
export * from './configuration/index.js'
export * from './listing/index.js'
export * from './metadata/index.js'
export * from './organisation/index.js'
export * from './publication/index.js'
export * from './theme/index.js'
4 changes: 2 additions & 2 deletions src/entities/organisation/organisation.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console */
import { Organisation } from './organisation';
import { mockOrganisation } from './organisation.mock';
import { Organisation } from './organisation'
import { mockOrganisation } from './organisation.mock'

describe('Organisation Store', () => {
it('create Organisation entity with full data', () => {
Expand Down
4 changes: 2 additions & 2 deletions src/entities/organisation/organisation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SafeParseReturnType, z } from 'zod';
import { TOrganisation } from './organisation.types';
import { SafeParseReturnType, z } from 'zod'
import { TOrganisation } from './organisation.types'

export class Organisation implements TOrganisation {

Expand Down
8 changes: 4 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Vue.mixin({ methods: { t, n } })
Vue.use(PiniaVuePlugin)

new Vue(
{
pinia,
render: h => h(App),
},
{
pinia,
render: h => h(App),
},
).$mount('#opencatalogi')
6 changes: 3 additions & 3 deletions src/sidebars/dashboard/DashboardSideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { navigationStore, searchStore, publicationStore } from '../../store/stor
<NcTextField class="searchField"
:value.sync="searchStore.search"
label="Zoeken" />
<NcNoteCard v-if="searchStore.searchError" type="error">
<p>{{ searchStore.searchError }}</p>
</NcNoteCard>
<NcNoteCard v-if="searchStore.searchError" type="error">
<p>{{ searchStore.searchError }}</p>
</NcNoteCard>
</NcAppSidebarTab>
<NcAppSidebarTab id="settings-tab" name="Publicaties" :order="2">
<template #icon>
Expand Down
6 changes: 3 additions & 3 deletions src/sidebars/search/SearchSideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import { searchStore } from '../../store/store.js'
<NcTextField class="searchField"
:value.sync="searchStore.search"
label="Zoeken" />
<NcNoteCard v-if="searchStore.searchError" type="error">
<p>{{ searchStore.searchError }}</p>
</NcNoteCard>
<NcNoteCard v-if="searchStore.searchError" type="error">
<p>{{ searchStore.searchError }}</p>
</NcNoteCard>
</NcAppSidebarTab>
<NcAppSidebarTab id="settings-tab" name="Catalogi" :order="2">
<template #icon>
Expand Down
40 changes: 20 additions & 20 deletions src/store/modules/catalogi.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,38 @@ describe(
'sets catalogi item correctly', () => {
const store = useCatalogiStore()

store.setCatalogiItem(mockCatalogi()[0])
store.setCatalogiItem(mockCatalogi()[0])

expect(store.catalogiItem).toBeInstanceOf(Catalogi)
expect(store.catalogiItem).toEqual(mockCatalogi()[0])
expect(store.catalogiItem).toBeInstanceOf(Catalogi)
expect(store.catalogiItem).toEqual(mockCatalogi()[0])

expect(store.catalogiItem.validate().success).toBe(true)
})
expect(store.catalogiItem.validate().success).toBe(true)
})

it(
'sets catalogi list correctly', () => {
const store = useCatalogiStore()

store.setCatalogiList(mockCatalogi())
store.setCatalogiList(mockCatalogi())

expect(store.catalogiList).toHaveLength(mockCatalogi().length)
expect(store.catalogiList).toHaveLength(mockCatalogi().length)

// list item 1
expect(store.catalogiList[0]).toBeInstanceOf(Catalogi)
expect(store.catalogiList[0]).toEqual(mockCatalogi()[0])
// list item 1
expect(store.catalogiList[0]).toBeInstanceOf(Catalogi)
expect(store.catalogiList[0]).toEqual(mockCatalogi()[0])

expect(store.catalogiList[0].validate().success).toBe(true)
expect(store.catalogiList[0].validate().success).toBe(true)

// list item 2
expect(store.catalogiList[1]).toBeInstanceOf(Catalogi)
expect(store.catalogiList[1]).toEqual(mockCatalogi()[1])
// list item 2
expect(store.catalogiList[1]).toBeInstanceOf(Catalogi)
expect(store.catalogiList[1]).toEqual(mockCatalogi()[1])

expect(store.catalogiList[1].validate().success).toBe(true)
expect(store.catalogiList[1].validate().success).toBe(true)

// list item 3
expect(store.catalogiList[2]).toBeInstanceOf(Catalogi)
expect(store.catalogiList[2]).toEqual(mockCatalogi()[2])
// list item 3
expect(store.catalogiList[2]).toBeInstanceOf(Catalogi)
expect(store.catalogiList[2]).toEqual(mockCatalogi()[2])

expect(store.catalogiList[2].validate().success).toBe(false)
expect(store.catalogiList[2].validate().success).toBe(false)
})
})
})
78 changes: 39 additions & 39 deletions src/store/modules/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,43 @@ import { defineStore } from 'pinia'
import { Configuration } from '../../entities/index.js'

export const useConfigurationStore = defineStore(
'configuration', {
state: () => ({
configurationItem: false,
configurationList: [],
}),
actions: {
setConfigurationItem(configurationItem) {
this.configurationItem = configurationItem && new Configuration(configurationItem)
console.log('Active configuration item set to ' + configurationItem)
},
/* istanbul ignore next */ // ignore this for Jest until moved into a service
async refreshConfiguration(search = null) {
// @todo this might belong in a service?
let endpoint = '/index.php/apps/opencatalogi/api/configuration'
if (search !== null && search !== '') {
endpoint = endpoint + '?_search=' + search
}
return fetch(
endpoint, {
method: 'GET',
}
)
.then(
(response) => {
response.json().then(
(data) => {
this.setConfigurationItem(data)
}
)
}
)
.catch(
(err) => {
console.error(err)
}
)
},
},
}
'configuration', {

Check failure on line 6 in src/store/modules/configuration.js

View workflow job for this annotation

GitHub Actions / build

Spaces must be used to indent lines; tabs are not allowed

Check failure on line 6 in src/store/modules/configuration.js

View workflow job for this annotation

GitHub Actions / build

Multi-line function call not indented correctly; expected 4 spaces but found 1
state: () => ({

Check failure on line 7 in src/store/modules/configuration.js

View workflow job for this annotation

GitHub Actions / build

Spaces must be used to indent lines; tabs are not allowed

Check failure on line 7 in src/store/modules/configuration.js

View workflow job for this annotation

GitHub Actions / build

Multi-line function call not indented correctly; expected 4 spaces but found 2

Check failure on line 7 in src/store/modules/configuration.js

View workflow job for this annotation

GitHub Actions / build

Line indented incorrectly; expected 8 spaces, found 2
configurationItem: false,

Check failure on line 8 in src/store/modules/configuration.js

View workflow job for this annotation

GitHub Actions / build

Spaces must be used to indent lines; tabs are not allowed

Check failure on line 8 in src/store/modules/configuration.js

View workflow job for this annotation

GitHub Actions / build

Multi-line function call not indented correctly; expected 4 spaces but found 3

Check failure on line 8 in src/store/modules/configuration.js

View workflow job for this annotation

GitHub Actions / build

Line indented incorrectly; expected 12 spaces, found 3
configurationList: [],

Check failure on line 9 in src/store/modules/configuration.js

View workflow job for this annotation

GitHub Actions / build

Spaces must be used to indent lines; tabs are not allowed

Check failure on line 9 in src/store/modules/configuration.js

View workflow job for this annotation

GitHub Actions / build

Multi-line function call not indented correctly; expected 4 spaces but found 3
}),
actions: {
setConfigurationItem(configurationItem) {
this.configurationItem = configurationItem && new Configuration(configurationItem)
console.log('Active configuration item set to ' + configurationItem)
},
/* istanbul ignore next */ // ignore this for Jest until moved into a service
async refreshConfiguration(search = null) {
// @todo this might belong in a service?
let endpoint = '/index.php/apps/opencatalogi/api/configuration'
if (search !== null && search !== '') {
endpoint = endpoint + '?_search=' + search
}
return fetch(
endpoint, {
method: 'GET',
},
)
.then(
(response) => {
response.json().then(
(data) => {
this.setConfigurationItem(data)
},
)
},
)
.catch(
(err) => {
console.error(err)
},
)
},
},
},
)
48 changes: 24 additions & 24 deletions src/store/modules/configuration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ import { Configuration, mockConfiguration } from '../../entities/index.js'
import { useConfigurationStore } from './configuration.js'

describe(
'Configuration Store', () => {
beforeEach(
() => {
setActivePinia(createPinia())
}
)
'Configuration Store', () => {
beforeEach(
() => {
setActivePinia(createPinia())
},
)

it(
'sets configuration item correctly', () => {
const store = useConfigurationStore()
it(
'sets configuration item correctly', () => {
const store = useConfigurationStore()

store.setConfigurationItem(mockConfiguration()[0])
store.setConfigurationItem(mockConfiguration()[0])

expect(store.configurationItem).toBeInstanceOf(Configuration)
expect(store.configurationItem).toEqual(mockConfiguration()[0])
expect(store.configurationItem.validate().success).toBe(true)
expect(store.configurationItem).toBeInstanceOf(Configuration)
expect(store.configurationItem).toEqual(mockConfiguration()[0])
expect(store.configurationItem.validate().success).toBe(true)

store.setConfigurationItem(mockConfiguration()[1])
store.setConfigurationItem(mockConfiguration()[1])

expect(store.configurationItem).toBeInstanceOf(Configuration)
expect(store.configurationItem).toEqual(mockConfiguration()[1])
expect(store.configurationItem.validate().success).toBe(true)
expect(store.configurationItem).toBeInstanceOf(Configuration)
expect(store.configurationItem).toEqual(mockConfiguration()[1])
expect(store.configurationItem.validate().success).toBe(true)

store.setConfigurationItem(mockConfiguration()[2])
store.setConfigurationItem(mockConfiguration()[2])

expect(store.configurationItem).toBeInstanceOf(Configuration)
expect(store.configurationItem).toEqual(mockConfiguration()[2])
expect(store.configurationItem.validate().success).toBe(false)
}
)
}
expect(store.configurationItem).toBeInstanceOf(Configuration)
expect(store.configurationItem).toEqual(mockConfiguration()[2])
expect(store.configurationItem.validate().success).toBe(false)
},
)
},
)
Loading

0 comments on commit 085107e

Please sign in to comment.