-
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.
Added DOMPurify module for sanitizing user input for forms. Update vscode launch.json for debugging. Update `.gitignore` to ignore files prefixed with a single underscore for files that I do not want added to the repository. Update test script to fix error adding the `--detectOpenHandles` argument. testing-library/dom-testing-library#524 Update tests - Added mocks for the app setup for the theme, routing, and state store. - Created `commonSetup.js` module that re-exports multiple mocks for a single import instead of multiple lines of mock imports. - Refactor `Home.test.tsx` to use the new `commonSetup.js` for importing the mocks. testing Netlify webhook test test added site id for netlify added auth token for netlify using cli typo vx.x.x specified build dir to deploy vx.x.x specified build dir to deploy
- Loading branch information
Showing
12 changed files
with
119 additions
and
19 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,40 @@ | ||
name: Deploy to Production | ||
|
||
on: | ||
push: | ||
branches: test | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@master | ||
|
||
- name: Use NodeJS 17.4.0 | ||
uses: actions/setup-node@master | ||
with: | ||
node-version: '17.4.0' | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
# - name: Test | ||
# run: npm test | ||
|
||
- name: Build | ||
run: npm run build | ||
|
||
# - name: Compile | ||
# run: npm start | ||
# env: | ||
# COMPILE_TEST: true | ||
|
||
- name: deploy build | ||
run: netlify deploy --prod --dir build --message "$MESSAGE" | ||
env: | ||
NETLIFY_SITE_ID: a115dba5-ccae-4bed-9f8d-938685aadb67 | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
MESSAGE: ${{ github.event.head_commit.message }} | ||
|
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
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 |
---|---|---|
|
@@ -48,4 +48,6 @@ if ( | |
argv.push(hasSourceControl ? '--watch' : '--watchAll') | ||
} | ||
|
||
argv.push('--detectOpenHandles') | ||
|
||
jest.run(argv) |
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,7 @@ | ||
/** | ||
* This file is used to easily export more than two mock implementations | ||
* through a single import file instead of multiple lines. | ||
*/ | ||
export { default as StoreMock } from './mocks/StoreMock' | ||
export { default as RoutingMock } from './mocks/RoutingMock' | ||
export { default as ThemeMock } from './mocks/ThemeMock' |
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,6 @@ | ||
import { BrowserRouter } from 'react-router-dom' | ||
import type { ReactNode } from 'react' | ||
|
||
export default ({ children }: { children: ReactNode }) => ( | ||
<BrowserRouter>{children}</BrowserRouter> | ||
) |
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,7 @@ | ||
import { Provider } from 'react-redux' | ||
import store from 'app/store' | ||
import type { ReactNode } from 'react' | ||
|
||
export default ({ children }: { children: ReactNode }) => ( | ||
<Provider store={store}>{children}</Provider> | ||
) |
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,11 @@ | ||
import { ThemeProvider } from '@mui/material/styles' | ||
import type { ReactNode } from 'react' | ||
import { StyleTheme, ComponentTheme } from 'assets/theme' | ||
|
||
const ThemeMock = ({ children }: { children: ReactNode }) => ( | ||
<ThemeProvider theme={StyleTheme('dark')}> | ||
<ThemeProvider theme={ComponentTheme}>{children}</ThemeProvider> | ||
</ThemeProvider> | ||
) | ||
|
||
export default ThemeMock |
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 |
---|---|---|
@@ -1,26 +1,21 @@ | ||
import * as React from 'react' | ||
import { BrowserRouter } from 'react-router-dom' | ||
import { ThemeProvider } from '@mui/material/styles' | ||
import { render, screen } from '@testing-library/react' | ||
import { Provider } from 'react-redux' | ||
import { StoreMock, RoutingMock, ThemeMock } from '../commonSetup' | ||
import Home from 'pages/Home' | ||
import store from 'app/store' | ||
import { StyleTheme } from 'assets/theme' | ||
|
||
// Need to import it manually because it has to set the window | ||
// property, whereas jest.mock() simply imports the module | ||
// eslint-disable-next-line jest/no-mocks-import | ||
import './__mocks__/intersectionObserverMock' | ||
import '../mocks/intersectionObserverMock' | ||
|
||
test('renders home page without crashing', () => { | ||
render( | ||
<Provider store={store}> | ||
<BrowserRouter> | ||
<ThemeProvider theme={StyleTheme('dark')}> | ||
<StoreMock> | ||
<RoutingMock> | ||
<ThemeMock> | ||
<Home /> | ||
</ThemeProvider> | ||
</BrowserRouter> | ||
</Provider> | ||
</ThemeMock> | ||
</RoutingMock> | ||
</StoreMock> | ||
) | ||
expect(screen.getByText(/your go-to helium center/i)).toBeInTheDocument() | ||
}) |