generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge partially branch 'main' of github.com:bcgov/nr-silva into fix/o…
…peningDesignReview
- Loading branch information
Showing
8 changed files
with
120 additions
and
22 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,37 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { describe, expect, it, vi } from 'vitest'; | ||
import BCHeader from '../../components/BCHeader'; | ||
import { ThemePreference } from '../../utils/ThemePreference'; | ||
import { BrowserRouter } from 'react-router-dom'; | ||
|
||
Object.defineProperty(window, 'matchMedia', { | ||
writable: true, | ||
value: vi.fn().mockImplementation(query => ({ | ||
matches: false, | ||
media: query, | ||
onchange: null, | ||
addListener: vi.fn(), // Deprecated | ||
removeListener: vi.fn(), // Deprecated | ||
addEventListener: vi.fn(), | ||
removeEventListener: vi.fn(), | ||
dispatchEvent: vi.fn() | ||
})) | ||
}); | ||
|
||
describe('BC Header component tests', () => { | ||
it('should have a Header with proper class name', () => { | ||
const { getByTestId, getByText } = render( | ||
<BrowserRouter> | ||
<ThemePreference> | ||
<BCHeader /> | ||
</ThemePreference> | ||
</BrowserRouter> | ||
); | ||
|
||
const element: HTMLElement | null = getByTestId('bc-header__header'); | ||
expect(element).toBeDefined(); | ||
expect(element).not.toBeNull(); | ||
expect(element?.classList.contains('spar-header')).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,34 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { describe, expect, it } from 'vitest'; | ||
import MyRecentActions from '../../components/MyRecentActions'; | ||
|
||
describe('My Recent Actions component tests', () => { | ||
it('should render the recent action component', () => { | ||
const { getByTestId, getByText } = render( | ||
<MyRecentActions /> | ||
); | ||
const text = 'Recent'; | ||
|
||
const element: HTMLElement | null = getByTestId('my-recent-actions__recent-tab-header'); | ||
expect(element).toBeDefined(); | ||
expect(element).not.toBeNull(); | ||
expect(element?.classList.contains('tab-header-recent')).toBe(true); | ||
const elementText: HTMLElement = getByText(text); | ||
expect(elementText.textContent).toEqual(text); | ||
}); | ||
|
||
it('should render the files and tabs action component', () => { | ||
const { getByTestId, getByText } = render( | ||
<MyRecentActions /> | ||
); | ||
const text = 'Files and Docs'; | ||
|
||
const element: HTMLElement | null = getByTestId('my-recent-actions__files-tab-header'); | ||
expect(element).toBeDefined(); | ||
expect(element).not.toBeNull(); | ||
expect(element?.classList.contains('tab-header-recent')).toBe(true); | ||
const elementText: HTMLElement = getByText(text); | ||
expect(elementText.textContent).toEqual(text); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { describe, expect, it, vi } from 'vitest'; | ||
import StatusTag from '../../components/StatusTag'; | ||
|
||
describe('Status Tag component tests', () => { | ||
it('should have completed color status tag rendered', () => { | ||
const colorKey = 'Completed'; | ||
|
||
const { getByTestId } = render( | ||
<StatusTag code={colorKey} /> | ||
); | ||
|
||
const element: HTMLElement | null = getByTestId(`tag__status_colored_tag_${colorKey}`); | ||
expect(element).toBeDefined(); | ||
}); | ||
}); |
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