-
Notifications
You must be signed in to change notification settings - Fork 6
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 #635 from systemli/Fix-tsc-errors
🚨 Fix tsc errors
- Loading branch information
Showing
10 changed files
with
31 additions
and
28 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
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
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,11 +1,11 @@ | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query' | ||
import { render, screen } from '@testing-library/react' | ||
import userEvent from '@testing-library/user-event' | ||
import sign from 'jwt-encode' | ||
import { MemoryRouter } from 'react-router' | ||
import { vi } from 'vitest' | ||
import { AuthProvider } from '../contexts/AuthContext' | ||
import sign from 'jwt-encode' | ||
import SettingsView from './SettingsView' | ||
import userEvent from '@testing-library/user-event' | ||
import { vi } from 'vitest' | ||
|
||
describe('SettingsView', function () { | ||
const jwt = sign({ id: 1, email: '[email protected]', roles: ['admin', 'user'] }, 'secret') | ||
|
@@ -38,7 +38,7 @@ describe('SettingsView', function () { | |
|
||
beforeEach(() => { | ||
vi.spyOn(window.localStorage.__proto__, 'getItem').mockReturnValue(jwt) | ||
fetch.resetMocks() | ||
fetchMock.resetMocks() | ||
}) | ||
|
||
function setup() { | ||
|
@@ -61,7 +61,7 @@ describe('SettingsView', function () { | |
} | ||
|
||
test('renders settings and open dialogs', async function () { | ||
fetch.mockIf(/^http:\/\/localhost:8080\/.*$/, (request: Request) => { | ||
fetchMock.mockIf(/^http:\/\/localhost:8080\/.*$/, (request: Request) => { | ||
if (request.url.endsWith('/admin/settings/inactive_settings')) { | ||
return Promise.resolve(inactiveSettingsResponse) | ||
} | ||
|
@@ -114,7 +114,7 @@ describe('SettingsView', function () { | |
}) | ||
|
||
test('settings could not fetched', async function () { | ||
fetch.mockReject(new Error('network error')) | ||
fetchMock.mockReject(new Error('network error')) | ||
setup() | ||
|
||
const loaders = screen.getAllByText(/loading/i) | ||
|
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,18 +1,18 @@ | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query' | ||
import { render, screen } from '@testing-library/react' | ||
import userEvent from '@testing-library/user-event' | ||
import sign from 'jwt-encode' | ||
import { MemoryRouter } from 'react-router' | ||
import { vi } from 'vitest' | ||
import { AuthProvider } from '../contexts/AuthContext' | ||
import UsersView from './UsersView' | ||
import sign from 'jwt-encode' | ||
import userEvent from '@testing-library/user-event' | ||
import { vi } from 'vitest' | ||
|
||
describe('UsersView', function () { | ||
const jwt = sign({ id: 1, email: '[email protected]', roles: ['admin', 'user'] }, 'secret') | ||
|
||
beforeEach(() => { | ||
vi.spyOn(window.localStorage.__proto__, 'getItem').mockReturnValue(jwt) | ||
fetch.resetMocks() | ||
fetchMock.resetMocks() | ||
}) | ||
|
||
function setup() { | ||
|
@@ -35,7 +35,7 @@ describe('UsersView', function () { | |
} | ||
|
||
test('renders list', async function () { | ||
fetch.mockResponseOnce( | ||
fetchMock.mockResponseOnce( | ||
JSON.stringify({ | ||
data: { | ||
users: [ | ||
|
@@ -57,15 +57,15 @@ describe('UsersView', function () { | |
|
||
test('open new users dialog', async function () { | ||
setup() | ||
fetch.mockIf( | ||
fetchMock.mockIf( | ||
/\/v1\/admin\/users/i, | ||
JSON.stringify({ | ||
data: { | ||
users: [], | ||
}, | ||
}) | ||
) | ||
fetch.mockIf( | ||
fetchMock.mockIf( | ||
/\/v1\/admin\/tickers/i, | ||
JSON.stringify({ | ||
data: { | ||
|
@@ -91,7 +91,7 @@ describe('UsersView', function () { | |
}) | ||
|
||
test('open dialog for existing user', async function () { | ||
fetch.mockIf( | ||
fetchMock.mockIf( | ||
/\/v1\/admin\/users/i, | ||
JSON.stringify({ | ||
data: { | ||
|
@@ -154,7 +154,7 @@ describe('UsersView', function () { | |
}) | ||
|
||
test('user list could not fetched', async function () { | ||
fetch.mockReject(new Error('network error')) | ||
fetchMock.mockReject(new Error('network error')) | ||
setup() | ||
|
||
expect(screen.getByText(/loading/i)).toBeInTheDocument() | ||
|