-
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.
- Loading branch information
Showing
6 changed files
with
68 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,15 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import { render, screen } from '@testing-library/react' | ||
import App from './App' | ||
|
||
describe('Root/App Page', () => { | ||
it('load page', () => { | ||
render(<App />) | ||
|
||
expect( | ||
screen.getByText( | ||
"Drag 'n' drop GPX- or FIT-files, or click to select files." | ||
) | ||
).toBeInTheDocument() | ||
}) | ||
}) |
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,40 @@ | ||
import { describe, expect, it, vi } from 'vitest' | ||
import { render, screen } from '@testing-library/react' | ||
import About from './About' | ||
|
||
const mocks = vi.hoisted(() => ({ get: vi.fn() })) | ||
|
||
vi.mock('axios', async (importActual) => { | ||
const actual = await importActual<typeof import('axios')>() | ||
const mockAxios = { | ||
default: { | ||
...actual.default, | ||
create: vi.fn(() => ({ | ||
...actual.default.create(), | ||
get: mocks.get, | ||
})), | ||
}, | ||
} | ||
return mockAxios | ||
}) | ||
|
||
describe('About Page', () => { | ||
it('load page', () => { | ||
render(<About />) | ||
expect( | ||
screen.getByText('An app dealing with GPS files.') | ||
).toBeInTheDocument() | ||
}) | ||
|
||
it('show version of backend', async () => { | ||
const version = 'v1.2.3' | ||
mocks.get.mockResolvedValueOnce({ | ||
data: { app: version, git: 'githash' }, | ||
}) | ||
|
||
render(<About />) | ||
|
||
expect(await screen.findByText(version)).toBeInTheDocument() | ||
expect(mocks.get).toHaveBeenCalled() | ||
}) | ||
}) |
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,10 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import { render, screen } from '@testing-library/react' | ||
import Home from './Home' | ||
|
||
describe('Home Page', () => { | ||
it('load page', () => { | ||
render(<Home />) | ||
expect(screen.getByText('GPS-Tools')).toBeInTheDocument() | ||
}) | ||
}) |
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