Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4aad765b6 |
No files matched your search
@@ -28,7 +28,7 @@ repos:
|
|||||||
stages: [ commit-msg ]
|
stages: [ commit-msg ]
|
||||||
additional_dependencies: [ '@commitlint/config-conventional' ]
|
additional_dependencies: [ '@commitlint/config-conventional' ]
|
||||||
- repo: https://github.com/pre-commit/mirrors-eslint
|
- repo: https://github.com/pre-commit/mirrors-eslint
|
||||||
rev: v10.10.0
|
rev: v10.9.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: eslint
|
- id: eslint
|
||||||
types: [ file ]
|
types: [ file ]
|
||||||
|
|||||||
@@ -14,23 +14,20 @@ const mockOrganizations = [
|
|||||||
// For now, the component is indirectly tested through useOrganizationSelector tests
|
// For now, the component is indirectly tested through useOrganizationSelector tests
|
||||||
// and manual testing shows it works correctly
|
// and manual testing shows it works correctly
|
||||||
|
|
||||||
// vi.mock is hoisted above the imports and the factory runs once, on the first
|
|
||||||
// import of the mocked module -- it was never re-applied per test despite sitting
|
|
||||||
// in beforeEach. vitest 5 rejects the nested call outright rather than silently
|
|
||||||
// hoisting it, so declare it where it actually executes.
|
|
||||||
vi.mock('~/composables/useOrganizationSelector', () => ({
|
|
||||||
useOrganizationSelector: () => ({
|
|
||||||
organizations: ref([mockOrganizations[0]]),
|
|
||||||
selectedOrganization: ref(mockOrganizations[0]),
|
|
||||||
selectedOrgId: ref('1'),
|
|
||||||
selectOrganization: mockSelectOrganization,
|
|
||||||
}),
|
|
||||||
}))
|
|
||||||
|
|
||||||
describe('OrganizationSwitcher - Single Organization', () => {
|
describe('OrganizationSwitcher - Single Organization', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.resetModules()
|
vi.resetModules()
|
||||||
mockSelectOrganization.mockClear()
|
mockSelectOrganization.mockClear()
|
||||||
|
|
||||||
|
// Mock with single organization
|
||||||
|
vi.mock('~/composables/useOrganizationSelector', () => ({
|
||||||
|
useOrganizationSelector: () => ({
|
||||||
|
organizations: ref([mockOrganizations[0]]),
|
||||||
|
selectedOrganization: ref(mockOrganizations[0]),
|
||||||
|
selectedOrgId: ref('1'),
|
||||||
|
selectOrganization: mockSelectOrganization,
|
||||||
|
}),
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should show a chip for single organization', async () => {
|
it('should show a chip for single organization', async () => {
|
||||||
|
|||||||
Generated
+451
-272
File diff suppressed because it is too large.
Load diff
+7
-7
@@ -36,7 +36,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "21.2.2",
|
"@commitlint/cli": "21.2.2",
|
||||||
"@commitlint/config-conventional": "21.2.2",
|
"@commitlint/config-conventional": "21.2.2",
|
||||||
"@graphql-codegen/cli": "7.4.0",
|
"@graphql-codegen/cli": "7.3.1",
|
||||||
"@graphql-codegen/typed-document-node": "7.1.0",
|
"@graphql-codegen/typed-document-node": "7.1.0",
|
||||||
"@graphql-codegen/typescript": "6.1.0",
|
"@graphql-codegen/typescript": "6.1.0",
|
||||||
"@graphql-codegen/typescript-operations": "6.1.6",
|
"@graphql-codegen/typescript-operations": "6.1.6",
|
||||||
@@ -46,19 +46,19 @@
|
|||||||
"@nuxtjs/stylelint-module": "5.2.1",
|
"@nuxtjs/stylelint-module": "5.2.1",
|
||||||
"@stylistic/eslint-plugin": "5.10.0",
|
"@stylistic/eslint-plugin": "5.10.0",
|
||||||
"@vitejs/plugin-vue": "6.0.8",
|
"@vitejs/plugin-vue": "6.0.8",
|
||||||
"@vitest/coverage-v8": "5.0.0",
|
"@vitest/coverage-v8": "4.1.11",
|
||||||
"@vue/test-utils": "2.5.0",
|
"@vue/test-utils": "2.5.0",
|
||||||
"eslint": "10.10.0",
|
"eslint": "10.9.1",
|
||||||
"eslint-plugin-simple-import-sort": "14.0.0",
|
"eslint-plugin-simple-import-sort": "14.0.0",
|
||||||
"eslint-plugin-vue": "10.11.0",
|
"eslint-plugin-vue": "10.10.0",
|
||||||
"jsdom": "30.0.1",
|
"jsdom": "30.0.1",
|
||||||
"postcss-html": "2.0.0",
|
"postcss-html": "2.0.0",
|
||||||
"stylelint": "17.15.0",
|
"stylelint": "17.14.1",
|
||||||
"stylelint-config-recommended-vue": "2.0.0",
|
"stylelint-config-recommended-vue": "2.0.0",
|
||||||
"stylelint-config-standard": "40.0.0",
|
"stylelint-config-standard": "40.0.0",
|
||||||
"typescript": "7.0.2",
|
"typescript": "7.0.2",
|
||||||
"typescript-eslint": "8.70.0",
|
"typescript-eslint": "8.69.0",
|
||||||
"vitest": "5.0.0",
|
"vitest": "4.1.11",
|
||||||
"vue-eslint-parser": "10.4.1"
|
"vue-eslint-parser": "10.4.1"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
|
|||||||
+1
-9
@@ -31,15 +31,7 @@ class LocalStorageMock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// jsdom defines localStorage as a getter-only accessor on the window object, so a
|
global.localStorage = new LocalStorageMock() as unknown as Storage
|
||||||
// plain assignment throws ("Cannot set property localStorage ... which has only a
|
|
||||||
// getter") under vitest 5, which no longer shadows it with a writable global.
|
|
||||||
// defineProperty replaces the accessor outright and works on both.
|
|
||||||
Object.defineProperty(globalThis, 'localStorage', {
|
|
||||||
value: new LocalStorageMock() as unknown as Storage,
|
|
||||||
writable: true,
|
|
||||||
configurable: true,
|
|
||||||
})
|
|
||||||
|
|
||||||
// Make Vue composables globally available
|
// Make Vue composables globally available
|
||||||
global.ref = Vue.ref
|
global.ref = Vue.ref
|
||||||
|
|||||||
Reference in new issue
Block a user