-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(gost): update version of vitest so we can use selectors
- Loading branch information
1 parent
e6bd92d
commit 37a1206
Showing
10 changed files
with
928 additions
and
316 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
57 changes: 57 additions & 0 deletions
57
packages/client/src/arpa_reporter/views/AgenciesView.browser.spec.js
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,57 @@ | ||
import { | ||
describe, it, expect, vi, beforeEach, | ||
} from 'vitest'; | ||
// import { mount } from '@vue/test-utils'; | ||
import { createStore } from 'vuex'; | ||
import { render } from 'vitest-browser-vue'; | ||
import { createRouter, createWebHistory } from 'vue-router'; | ||
import AgenciesView from '@/arpa_reporter/views/AgenciesView.vue'; | ||
|
||
describe('AgenciesView', () => { | ||
const mockAgencies = [ | ||
{ id: 1, code: 'AG1', name: 'Agency One' }, | ||
{ id: 2, code: 'AG2', name: 'Agency Two' }, | ||
]; | ||
|
||
const store = createStore({ | ||
state: { | ||
agencies: mockAgencies, | ||
}, | ||
actions: { | ||
updateAgencies: vi.fn(), | ||
}, | ||
}); | ||
|
||
const router = createRouter({ | ||
history: createWebHistory(), | ||
routes: [ | ||
{ path: '/agencies/new', name: 'new-agency' }, | ||
{ path: '/agencies/:id', name: 'edit-agency' }, | ||
], | ||
}); | ||
|
||
let screen; | ||
|
||
beforeEach(() => { | ||
screen = render(AgenciesView, { | ||
global: { | ||
plugins: [store, router], | ||
}, | ||
}); | ||
}); | ||
|
||
it('renders the agencies table with correct headings', () => { | ||
expect(screen.getByRole('heading', { name: /agencies/i, level: 1 }).element()).toBeInTheDocument(); | ||
}); | ||
|
||
it('displays agency data correctly', () => { | ||
mockAgencies.forEach((agency) => { | ||
expect(screen.getByText(agency.code).element()).toBeInTheDocument(); | ||
expect(screen.getByText(agency.name).element()).toBeInTheDocument(); | ||
}); | ||
}); | ||
|
||
it('has a create new agency button', () => { | ||
expect(screen.getByRole('link', { name: /create new agency/i }).element()).toBeInTheDocument(); | ||
}); | ||
}); |
36 changes: 0 additions & 36 deletions
36
packages/client/src/arpa_reporter/views/AgenciesView.spec.js
This file was deleted.
Oops, something went wrong.
Binary file added
BIN
+15.4 KB
.../AgenciesView.browser.spec.js/AgenciesView-displays-agency-data-correctly-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.4 KB
.../AgenciesView.browser.spec.js/AgenciesView-has-a-create-new-agency-button-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.4 KB
...ser.spec.js/AgenciesView-renders-the-agencies-table-with-correct-headings-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,55 @@ | ||
import vue from '@vitejs/plugin-vue'; | ||
import { defineConfig, loadEnv } from 'vite'; | ||
import path from 'path'; | ||
|
||
export default defineConfig(({ mode }) => { | ||
const env = loadEnv(mode, process.cwd(), ''); | ||
|
||
return { | ||
plugins: [ | ||
vue({ | ||
template: { | ||
compilerOptions: { | ||
compatConfig: { | ||
MODE: 2, | ||
}, | ||
}, | ||
}, | ||
}), | ||
], | ||
resolve: { | ||
alias: { | ||
vue: '@vue/compat', | ||
'@': path.resolve(__dirname, './src'), | ||
}, | ||
}, | ||
test: { | ||
environment: 'jsdom', | ||
globals: true, | ||
setupFiles: ['vitest.setup.ts'], | ||
alias: { | ||
vue: 'vue', | ||
}, | ||
browser: { | ||
provider: 'playwright', | ||
enabled: true, | ||
name: 'chromium', | ||
headless: true, | ||
}, | ||
include: ['**/*.browser.spec.{js,jsx}'], | ||
coverage: { | ||
provider: 'istanbul', | ||
include: ['src/**'], | ||
reporter: [ | ||
['text', { file: process.env.CI ? 'coverage.txt' : null }], // Direct to file in CI; direct to stdout otherwise | ||
'html', | ||
'clover', | ||
'json', | ||
], | ||
}, | ||
}, | ||
define: { | ||
'process.env': env, | ||
}, | ||
}; | ||
}); |
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
Oops, something went wrong.