-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
210 additions
and
19 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 |
---|---|---|
@@ -1,16 +1,81 @@ | ||
import { describe, test } from 'vitest'; | ||
import { describe, test, expect } from 'vitest'; | ||
import { render, screen } from '@testing-library/react'; | ||
import App from '@pages/content/sidebar/app'; | ||
import App from './app'; | ||
|
||
describe('appTest', () => { | ||
test('render text', () => { | ||
// given | ||
const text = 'content view'; | ||
describe('contentSidebar', () => { | ||
test('test structure', () => { | ||
render(<App />); | ||
|
||
// Test that the toggle element exists and has the correct id | ||
const toggle = screen.getByTestId('test-tobethebest-toggle'); | ||
expect(toggle).toBeInTheDocument(); | ||
expect(toggle.id).toBe('tobethebest-toggle'); | ||
|
||
// Test that the sidebar element exists and has the correct id | ||
const sidebar = screen.getByTestId('test-tobethebest-sidebar'); | ||
expect(sidebar).toBeInTheDocument(); | ||
expect(sidebar.id).toBe('tobethebest-sidebar'); | ||
|
||
// Test that the sidebar container element exists and has the correct id | ||
const sidebarContainer = screen.getByTestId('test-tobethebest-sidebar__container'); | ||
expect(sidebarContainer).toBeInTheDocument(); | ||
expect(sidebarContainer.id).toBe('tobethebest-sidebar__container'); | ||
|
||
// when | ||
// Test that the sidebar header element exists and has the correct id | ||
const sidebarHeader = screen.getByTestId('test-tobethebest-sidebar-header'); | ||
expect(sidebarHeader).toBeInTheDocument(); | ||
expect(sidebarHeader.id).toBe('tobethebest-sidebar-header'); | ||
|
||
// Test that the sidebar teambuilder element exists and has the correct id | ||
const sidebarTeambuilder = screen.getByTestId('test-tobethebest-sidebar-teambuilder'); | ||
expect(sidebarTeambuilder).toBeInTheDocument(); | ||
expect(sidebarTeambuilder.id).toBe('tobethebest-sidebar-teambuilder'); | ||
|
||
// Test that the sidebar resources element exists and has the correct id | ||
const sidebarResources = screen.getByTestId('test-tobethebest-sidebar-resources'); | ||
expect(sidebarResources).toBeInTheDocument(); | ||
expect(sidebarResources.id).toBe('tobethebest-sidebar-resources'); | ||
}); | ||
|
||
test('test content', () => { | ||
render(<App />); | ||
|
||
// then | ||
screen.getByText(text); | ||
// Test that the toggle div contains a child paragraph | ||
const toggle = screen.getByTestId('test-tobethebest-toggle'); | ||
const toggleParagraph = toggle.querySelector('p#tobethebest-toggle__text'); | ||
expect(toggleParagraph).toBeInTheDocument(); | ||
expect(toggleParagraph.textContent).toBe('ToBeTheBest'); | ||
|
||
// Test that the sidebar header contains a child h1 | ||
const sidebarHeader = screen.getByTestId('test-tobethebest-sidebar-header'); | ||
const sidebarHeaderH1 = sidebarHeader.querySelector('h1'); | ||
expect(sidebarHeaderH1).toBeInTheDocument(); | ||
expect(sidebarHeaderH1.textContent).toBe('ToBeTheBest'); | ||
|
||
// Test that the sidebar teambuilder contains a child h2 and button | ||
const sidebarTeambuilder = screen.getByTestId('test-tobethebest-sidebar-teambuilder'); | ||
const sidebarTeambuilderH2 = sidebarTeambuilder.querySelector('h2'); | ||
expect(sidebarTeambuilderH2).toBeInTheDocument(); | ||
expect(sidebarTeambuilderH2.textContent).toBe('Team Builder'); | ||
const sidebarTeambuilderButton = sidebarTeambuilder.querySelector('button'); | ||
expect(sidebarTeambuilderButton).toBeInTheDocument(); | ||
expect(sidebarTeambuilderButton.id).toBe('tobethebest-teambuilder-button'); | ||
expect(sidebarTeambuilderButton.textContent).toBe('Create Team'); | ||
|
||
// Test that the sidebar resources contains a child h2 and three buttons | ||
const sidebarResources = screen.getByTestId('test-tobethebest-sidebar-resources'); | ||
const sidebarResourcesH2 = sidebarResources.querySelector('h2'); | ||
expect(sidebarResourcesH2).toBeInTheDocument(); | ||
expect(sidebarResourcesH2.textContent).toBe('Resources'); | ||
const sidebarResourcesButtons = sidebarResources.querySelectorAll('button'); | ||
expect(sidebarResourcesButtons).toHaveLength(3); | ||
expect(sidebarResourcesButtons[0].id).toBe('tobethebest-website-button'); | ||
expect(sidebarResourcesButtons[0].textContent).toBe('Website'); | ||
expect(sidebarResourcesButtons[1].id).toBe('tobethebest-wiki-button'); | ||
expect(sidebarResourcesButtons[1].textContent).toBe('Wiki'); | ||
expect(sidebarResourcesButtons[2].id).toBe('tobethebest-github-button'); | ||
expect(sidebarResourcesButtons[2].textContent).toBe('Github'); | ||
|
||
}); | ||
}); | ||
|
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import "@testing-library/jest-dom/vitest"; |
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