-
Notifications
You must be signed in to change notification settings - Fork 9
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 #39 from netzwerg/38-vitejs-migration
Vite.js Migration
- Loading branch information
Showing
28 changed files
with
3,341 additions
and
5,429 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 |
---|---|---|
@@ -1 +1 @@ | ||
REACT_APP_VERSION=$npm_package_version | ||
# Prefix .env-variables with `VITE_` |
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,4 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx yarpm-yarn lint-staged && npx tsc && npx yarpm-yarn run lint | ||
npx -p yarpm yarpm-yarn lint-staged && npx tsc && npx -p yarpm yarpm-yarn run lint |
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,9 +1,8 @@ | ||
module.exports = { | ||
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], | ||
addons: [ | ||
'@storybook/addon-links', | ||
'@storybook/addon-essentials', | ||
'@storybook/preset-create-react-app', | ||
'storybook-addon-mui-mode', | ||
], | ||
addons: ['@storybook/addon-links', '@storybook/addon-essentials', 'storybook-dark-mode'], | ||
framework: '@storybook/react', | ||
core: { | ||
builder: 'storybook-builder-vite', | ||
}, | ||
} |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<link rel="apple-touch-icon" href="logo192.png" /> | ||
<!-- | ||
manifest.json provides metadata used when your web app is installed on a | ||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/ | ||
--> | ||
<link rel="manifest" href="manifest.json" /> | ||
<title>Vite App</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
</html> |
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
Binary file not shown.
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
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,10 +1,8 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { render, screen } from '../../test/test-utils' | ||
import { ChatErrors } from './ChatErrors' | ||
import { noOp } from '../../utils' | ||
|
||
it('renders without crashing', () => { | ||
const div = document.createElement('div') | ||
ReactDOM.render(<ChatErrors errors={[]} onDismissErrors={noOp} />, div) | ||
ReactDOM.unmountComponentAtNode(div) | ||
render(<ChatErrors errors={[{ error: 'Error' }]} onDismissErrors={noOp} />) | ||
expect(screen.getByText(/error\(s\)/)).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 |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { render, screen } from '../../test/test-utils' | ||
import { ChatHistory } from './ChatHistory' | ||
import { noOp } from '../../utils' | ||
|
||
it('renders without crashing', () => { | ||
const div = document.createElement('div') | ||
ReactDOM.render(<ChatHistory messages={[]} onDeleteMessage={noOp} />, div) | ||
ReactDOM.unmountComponentAtNode(div) | ||
render(<ChatHistory messages={[{ text: 'Test Message', timestamp: 0 }]} onDeleteMessage={noOp} />) | ||
expect(screen.getByText('Test Message')).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 |
---|---|---|
@@ -1,10 +1,29 @@ | ||
import React from 'react' | ||
import ReactDOM from 'react-dom' | ||
import { vi } from 'vitest' | ||
import { render, screen, userEvent, waitFor } from '../../test/test-utils' | ||
import { ChatInput } from './ChatInput' | ||
import { noOp } from '../../utils' | ||
|
||
it('renders without crashing', () => { | ||
const div = document.createElement('div') | ||
ReactDOM.render(<ChatInput onAddMessage={noOp} onFetchAsyncMessage={noOp} onDemoError={noOp} />, div) | ||
ReactDOM.unmountComponentAtNode(div) | ||
it('renders without crashing', async () => { | ||
const onAddMessageMock = vi.fn() | ||
|
||
render(<ChatInput onAddMessage={onAddMessageMock} onFetchAsyncMessage={noOp} onDemoError={noOp} />) | ||
|
||
//screen.logTestingPlaygroundURL() | ||
|
||
const input = screen.getByRole('textbox') | ||
|
||
expect(input).toBeInTheDocument() | ||
|
||
userEvent.type(input, 'My custom Message') | ||
|
||
expect(input).toHaveValue('My custom Message') | ||
|
||
userEvent.type(input, '{Enter}') | ||
|
||
await waitFor(() => { | ||
expect(input).toHaveValue('') | ||
}) | ||
|
||
expect(onAddMessageMock).toHaveBeenCalled() | ||
expect(onAddMessageMock).toHaveBeenCalledWith('My custom Message') | ||
}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
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
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' |
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,14 @@ | ||
/* eslint-disable import/export */ | ||
import { render } from '@testing-library/react' | ||
|
||
const customRender = (ui: React.ReactElement, options = {}) => | ||
render(ui, { | ||
// wrap provider(s) here if needed | ||
wrapper: ({ children }) => children, | ||
...options, | ||
}) | ||
|
||
export * from '@testing-library/react' | ||
export { default as userEvent } from '@testing-library/user-event' | ||
// override render export | ||
export { customRender as render } |
Oops, something went wrong.