-
Notifications
You must be signed in to change notification settings - Fork 30
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
9 changed files
with
1,704 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ | ||
} |
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
File renamed without changes.
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,75 @@ | ||
import { render, screen } from '@testing-library/react' | ||
import { expect, test } from '@jest/globals'; | ||
import userEvent from "@testing-library/user-event"; | ||
import { Preferences } from '../pages/Preferences'; | ||
const { setTheme } = jest.requireActual('../pages/Preferences'); | ||
// Wrapper | ||
let wrapper; | ||
|
||
/** | ||
* | ||
*/ | ||
beforeEach(() => { | ||
wrapper = render(<Preferences />) | ||
}); | ||
|
||
/** | ||
* | ||
*/ | ||
describe('Calling the preference page', () => { | ||
test('Should render preferences', () => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}) | ||
}) | ||
|
||
/** | ||
* | ||
*/ | ||
describe('Select the light theme', () => { | ||
test('Should select light theme', () => { | ||
userEvent.selectOptions( | ||
screen.getByRole('combobox', { name: "Theme" }), | ||
screen.getByRole('option', { name: 'light' })); | ||
|
||
expect(screen.getByRole('option', { name: 'light' }).selected).toBe(true) | ||
|
||
expect(wrapper).toMatchSnapshot(); | ||
}) | ||
}) | ||
|
||
/** | ||
* | ||
*/ | ||
describe('Select the dark theme', () => { | ||
test('Should select dark theme', () => { | ||
userEvent.selectOptions( | ||
screen.getByRole('combobox', { name: "Theme" }), | ||
screen.getByRole('option', { name: 'dark' })); | ||
|
||
expect(screen.getByRole('option', { name: 'dark' }).selected).toBe(true) | ||
|
||
expect(wrapper).toMatchSnapshot(); | ||
}) | ||
}) | ||
|
||
/** | ||
* | ||
*/ | ||
describe('Test number of themes', () => { | ||
test('Should have four themes', () => { | ||
let theme = screen.getByRole('combobox', { name: "Theme" }); | ||
expect(theme).toHaveLength(4); | ||
expect(wrapper).toMatchSnapshot(); | ||
}) | ||
}) | ||
|
||
/** | ||
* | ||
*/ | ||
describe('Test byte representation', () => { | ||
test('Should have two options', () => { | ||
let theme = screen.getByRole('combobox', { name: "Byte representation" }); | ||
expect(theme).toHaveLength(2); | ||
expect(wrapper).toMatchSnapshot(); | ||
}) | ||
}) |
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,22 @@ | ||
import axios from 'axios'; | ||
import React from 'react'; | ||
import App from '../App'; | ||
import { render } from '@testing-library/react'; | ||
|
||
jest.mock('axios'); | ||
|
||
// Wrapper | ||
let wrapper; | ||
|
||
/** | ||
* | ||
*/ | ||
beforeEach(() => { | ||
wrapper = render(<App />) | ||
}); | ||
|
||
describe('Testing the app', () => { | ||
test('Should render the app', () => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}) | ||
}) |
Oops, something went wrong.