-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(main): test include front coverage to sonar
- Loading branch information
Showing
26 changed files
with
582 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
.DS_Store | ||
node_modules | ||
/dist | ||
/coverage | ||
|
||
dist | ||
coverage | ||
.scannerwork | ||
|
||
# local env files | ||
.env.local | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,18 @@ | ||
import {switchMap, take} from "rxjs/operators"; | ||
import {HttpStatusError} from "@/common/errors/HttpStatusError"; | ||
import {from, Observable} from "rxjs"; | ||
import { switchMap, take } from 'rxjs/operators'; | ||
import { HttpStatusError } from '@/common/errors/HttpStatusError'; | ||
import { from, Observable } from 'rxjs'; | ||
import rest from '@/common/services/RestWrapper'; | ||
|
||
export class TagsService { | ||
/** | ||
* List all available tags from backend | ||
*/ | ||
list(): Observable<string[]> { | ||
return rest.get('/tags').pipe( | ||
switchMap(response => { | ||
if (response.ok) { | ||
const data: Observable<string[]> = from(response.json()); | ||
return data; | ||
} else { | ||
throw new HttpStatusError(response.status, `Error while getting tags.`); | ||
} | ||
}), | ||
take(1) | ||
); | ||
} | ||
export function tagsListAll(): Observable<string[]> { | ||
return rest.get('/tags').pipe( | ||
switchMap(response => { | ||
if (response.ok) { | ||
const data: Observable<string[]> = from(response.json()); | ||
return data; | ||
} else { | ||
throw new HttpStatusError(response.status, `Error while getting tags.`); | ||
} | ||
}), | ||
take(1), | ||
); | ||
} | ||
|
||
export default new TagsService(); |
32 changes: 32 additions & 0 deletions
32
seaside/tests/unit/administration/component/UserAdminTab.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { describe, expect, test, vi } from 'vitest'; | ||
import { mount } from '@vue/test-utils'; | ||
import { createI18n } from 'vue-i18n'; | ||
import UserAdminTab from '@/administration/component/UserAdminTab.vue'; | ||
import { of } from 'rxjs'; | ||
import { userList } from '@/security/services/UserService'; | ||
|
||
vi.mock('@/security/services/UserService', () => { | ||
return { | ||
userList: vi.fn().mockImplementation(() => of({ data: [] })), | ||
}; | ||
}); | ||
|
||
describe('UserAdminTab', () => { | ||
test('render user admin tab', () => { | ||
|
||
const i18n = createI18n({ | ||
legacy: false, | ||
missingWarn: false, | ||
messages: { 'en': {} }, | ||
}); | ||
|
||
const wrapper = mount(UserAdminTab, { | ||
global: { | ||
plugins: [i18n], | ||
}, | ||
}); | ||
expect(wrapper.find('table').exists()).toBe(true); | ||
expect(wrapper.find('table').attributes('aria-describedby')).toEqual('User List'); | ||
expect(userList).toHaveBeenCalledWith(0); | ||
}); | ||
}); |
48 changes: 48 additions & 0 deletions
48
seaside/tests/unit/administration/page/AdministrationPage.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { describe, expect, test, vi } from 'vitest'; | ||
import { mount } from '@vue/test-utils'; | ||
import { createI18n } from 'vue-i18n'; | ||
import AdministrationPage from '@/administration/page/AdministrationPage.vue'; | ||
import { createRouter, createWebHashHistory } from 'vue-router'; | ||
import { routes as adminRoutes } from '@/administration/router'; | ||
import LoginPage from '@/security/pages/LoginPage.vue'; | ||
import UserAdminTab from '@/administration/component/UserAdminTab.vue'; | ||
import { of } from 'rxjs'; | ||
|
||
vi.mock('@/security/services/UserService', () => { | ||
return { | ||
userList: vi.fn().mockImplementation(() => of({ data: [] })), | ||
}; | ||
}); | ||
|
||
describe('AdministrationPage', () => { | ||
test('render user /admin page', async () => { | ||
|
||
const $store = { | ||
state: { user: { user: { _id: '42' } } }, | ||
commit: vi.fn(), | ||
}; | ||
const i18n = createI18n({ | ||
legacy: false, | ||
missingWarn: false, | ||
messages: { 'en': {} }, | ||
}); | ||
|
||
const router = createRouter({ | ||
history: createWebHashHistory(), | ||
routes: [ | ||
...adminRoutes, | ||
{ path: '/', component: LoginPage, name: 'test' }, | ||
], | ||
}); | ||
await router.push('/admin'); | ||
await router.isReady(); | ||
const wrapper = mount(AdministrationPage, { | ||
global: { | ||
plugins: [i18n, router], | ||
provide: { store: $store }, | ||
}, | ||
}); | ||
expect(wrapper.find('nav').exists()).toBe(true); | ||
expect(wrapper.findComponent(UserAdminTab).isVisible()).toBe(true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { describe, expect, test } from 'vitest'; | ||
import { mount } from '@vue/test-utils'; | ||
import BaywatchIcon from '@/common/components/BaywatchIcon.vue'; | ||
|
||
describe('BaywatchIcon', () => { | ||
test('render Baywatch Icon', async () => { | ||
const wrapper = mount(BaywatchIcon); | ||
|
||
expect(wrapper.find('svg').exists()).toBe(true); | ||
}); | ||
}); |
22 changes: 22 additions & 0 deletions
22
seaside/tests/unit/common/components/FileUploadWindow.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { describe, expect, test } from 'vitest'; | ||
import { mount } from '@vue/test-utils'; | ||
import { createI18n } from 'vue-i18n'; | ||
import FileUploadWindow from '@/common/components/FileUploadWindow.vue'; | ||
|
||
describe('FileUploadWindow', () => { | ||
test('render file upload window', async () => { | ||
const i18n = createI18n({ | ||
legacy: false, | ||
missingWarn: false, | ||
messages: { 'en': {} }, | ||
}); | ||
|
||
const wrapper = mount(FileUploadWindow, { | ||
global: { | ||
plugins: [i18n], | ||
}, | ||
}); | ||
|
||
expect(wrapper.find('button').exists()).toBe(true); | ||
}); | ||
}); |
Oops, something went wrong.