-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #666 from codeforpdx/662/asterner-unit-tests
vitest: fix several tests
- Loading branch information
Showing
7 changed files
with
68 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
// import React from 'react'; | ||
// import { render } from '@testing-library/react'; | ||
// import { expect, it, describe } from 'vitest'; | ||
// import { FinancialInfo } from '@components/CivicProfileForms'; | ||
import { it, describe } from 'vitest'; | ||
|
||
// describe('Financial Info Form', () => { | ||
// it('renders', () => { | ||
// const { getByText } = render(<FinancialInfo />); | ||
// expect(getByText('Financial Information')).not.toBeNull(); | ||
// }); | ||
// }); | ||
describe.todo('Financial Info Form', () => { | ||
it('renders', () => { | ||
// const { getByText } = render(<FinancialInfo />); | ||
// expect(getByText('Financial Information')).not.toBeNull(); | ||
}); | ||
}); |
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,38 +1,51 @@ | ||
// import React from 'react'; | ||
// import { BrowserRouter } from 'react-router-dom'; | ||
// import { render } from '@testing-library/react'; | ||
// import { describe, expect, it } from 'vitest'; | ||
// import { CivicProfile } from '@pages'; | ||
// import createMatchMedia from '../helpers/createMatchMedia'; | ||
import React from 'react'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
import { render } from '@testing-library/react'; | ||
import { describe, expect, it } from 'vitest'; | ||
import { CivicProfile } from '@pages'; | ||
import { CIVIC_FORM_LIST } from '@components/CivicProfileForms'; | ||
import createMatchMedia from '../helpers/createMatchMedia'; | ||
|
||
// TODO: Rewrite tests to align with changes in CivicProfile component | ||
// e.g. "successfully navigates to Basic Information" | ||
// describe('CivicProfile Page', () => { | ||
// it('renders page container flex direction as row and nav container width as 25% by default', () => { | ||
// const component = render( | ||
// <BrowserRouter> | ||
// <CivicProfile /> | ||
// </BrowserRouter> | ||
// ); | ||
// const componentContainer = component.container.firstChild; | ||
// const navContainer = componentContainer.firstChild; | ||
// const componentContainerStyles = getComputedStyle(componentContainer); | ||
// const navContainerStyles = getComputedStyle(navContainer); | ||
// expect(componentContainerStyles.flexDirection).toBe('row'); | ||
// expect(navContainerStyles.width).toBe('25%'); | ||
// }); | ||
// it('renders page container flex direction as column and nav container width as 100% below 600px', () => { | ||
// window.matchMedia = createMatchMedia(599); | ||
// const component = render( | ||
// <BrowserRouter> | ||
// <CivicProfile /> | ||
// </BrowserRouter> | ||
// ); | ||
// const componentContainer = component.container.firstChild; | ||
// const navContainer = componentContainer.firstChild; | ||
// const componentContainerStyles = getComputedStyle(componentContainer); | ||
// const navContainerStyles = getComputedStyle(navContainer); | ||
// expect(componentContainerStyles.flexDirection).toBe('column'); | ||
// expect(navContainerStyles.width).toBe('100%'); | ||
// }); | ||
// }); | ||
describe.todo('CivicProfile Page', () => { | ||
it('renders page container flex direction as row and nav container width as 25% by default', () => { | ||
const component = render( | ||
<BrowserRouter> | ||
<CivicProfile /> | ||
</BrowserRouter> | ||
); | ||
const componentContainer = component.container.firstChild; | ||
const navContainer = componentContainer.firstChild; | ||
const componentContainerStyles = getComputedStyle(componentContainer); | ||
const navContainerStyles = getComputedStyle(navContainer); | ||
expect(componentContainerStyles.flexDirection).toBe('row'); | ||
expect(navContainerStyles.width).toBe('25%'); | ||
}); | ||
|
||
it('renders page container flex direction as column and nav container width as 100% below 600px', () => { | ||
window.matchMedia = createMatchMedia(599); | ||
const component = render( | ||
<BrowserRouter> | ||
<CivicProfile /> | ||
</BrowserRouter> | ||
); | ||
const componentContainer = component.container.firstChild; | ||
const navContainer = componentContainer.firstChild; | ||
const componentContainerStyles = getComputedStyle(componentContainer); | ||
const navContainerStyles = getComputedStyle(navContainer); | ||
expect(componentContainerStyles.flexDirection).toBe('column'); | ||
expect(navContainerStyles.width).toBe('100%'); | ||
}); | ||
|
||
it('renders buttons for all forms in CIVIC_FORM_LIST', () => { | ||
const numLinks = CIVIC_FORM_LIST.length; | ||
const { getByRole, getAllByRole } = render( | ||
<BrowserRouter> | ||
<CivicProfile /> | ||
</BrowserRouter> | ||
); | ||
expect(getByRole('navigation')).not.toBeNull(); | ||
expect(getAllByRole('tab').length).toEqual(numLinks); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
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