-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Quality Updates - Part 2 #240
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
729df79
Fix server type test console errors.
jbouder b5b88c4
Add more tests.
jbouder 0c6af9c
Merge branch 'main' into code-quality-updates-2
jbouder b9da144
Update app to set switch background based on theme.
jbouder 3002b32
Fix app thumbnail background styling.
jbouder b6a203e
Fix test errors.
jbouder c85864c
Remove dev environment config from jest testing.
jbouder 2645878
Add new build.
jbouder 36f561d
Add and update unit tests for better coverage. Remove old prop from c…
jbouder 43d2ab7
Add new build.
jbouder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,6 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is no longer used in the card, removing |
||
serverStatus="ready" | ||
/> | ||
</QueryClientProvider> | ||
|
@@ -49,15 +48,15 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
serverStatus="ready" | ||
serverStatus="Pending" | ||
/> | ||
</QueryClientProvider> | ||
</RecoilRoot>, | ||
); | ||
expect(baseElement).toBeInTheDocument(); | ||
const appLabel = baseElement.querySelector('.MuiTypography-h5'); | ||
expect(appLabel).toHaveTextContent('Test App'); | ||
expect(baseElement).toHaveTextContent('Pending'); | ||
}); | ||
|
||
test('renders default app card with no server status', async () => { | ||
|
@@ -70,7 +69,6 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
serverStatus="" | ||
/> | ||
</QueryClientProvider> | ||
|
@@ -91,8 +89,7 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
serverStatus="ready" | ||
serverStatus="Ready" | ||
isAppCard={false} | ||
/> | ||
</QueryClientProvider> | ||
|
@@ -116,9 +113,8 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
thumbnail="/some-thumbnail.png" | ||
serverStatus="ready" | ||
serverStatus="Ready" | ||
/> | ||
</QueryClientProvider> | ||
</RecoilRoot>, | ||
|
@@ -142,7 +138,6 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
thumbnail="/some-thumbnail.png" | ||
serverStatus="Ready" | ||
/> | ||
|
@@ -153,13 +148,15 @@ describe('AppCard', () => { | |
const menu = baseElement.querySelectorAll( | ||
'.MuiButtonBase-root', | ||
)[0] as HTMLButtonElement; | ||
expect(menu).toBeInTheDocument(); | ||
await act(async () => { | ||
menu.click(); | ||
}); | ||
|
||
const btn = baseElement.querySelectorAll( | ||
'.MuiList-root li.MuiButtonBase-root', | ||
)[0] as HTMLAnchorElement; | ||
expect(btn).toBeInTheDocument(); | ||
await act(async () => { | ||
btn.click(); | ||
}); | ||
|
@@ -177,7 +174,6 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
thumbnail="/some-thumbnail.png" | ||
serverStatus="Ready" | ||
/> | ||
|
@@ -195,6 +191,9 @@ describe('AppCard', () => { | |
const btn = baseElement.querySelectorAll( | ||
'.MuiList-root li.MuiButtonBase-root', | ||
)[0] as HTMLAnchorElement; | ||
expect(btn).toBeInTheDocument(); | ||
expect(btn).toHaveTextContent('Start'); | ||
expect(btn).not.toHaveAttribute('disabled', 'disabled'); | ||
await act(async () => { | ||
btn.click(); | ||
}); | ||
|
@@ -223,7 +222,6 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
thumbnail="/some-thumbnail.png" | ||
serverStatus="Running" | ||
/> | ||
|
@@ -258,7 +256,6 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
thumbnail="/some-thumbnail.png" | ||
serverStatus="Running" | ||
/> | ||
|
@@ -276,6 +273,9 @@ describe('AppCard', () => { | |
const btn = baseElement.querySelectorAll( | ||
'.MuiList-root li.MuiButtonBase-root', | ||
)[1] as HTMLAnchorElement; | ||
expect(btn).toBeInTheDocument(); | ||
expect(btn).toHaveTextContent('Stop'); | ||
expect(btn).not.toHaveAttribute('disabled', 'disabled'); | ||
await act(async () => { | ||
btn.click(); | ||
}); | ||
|
@@ -314,7 +314,6 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
thumbnail="/some-thumbnail.png" | ||
serverStatus="Ready" | ||
/> | ||
|
@@ -331,13 +330,17 @@ describe('AppCard', () => { | |
|
||
const btn = baseElement.querySelectorAll( | ||
'.MuiList-root li.MuiButtonBase-root', | ||
)[0] as HTMLAnchorElement; | ||
)[2] as HTMLAnchorElement; | ||
expect(btn).toBeInTheDocument(); | ||
expect(btn).toHaveTextContent('Edit'); | ||
expect(btn).not.toHaveAttribute('disabled', 'disabled'); | ||
await act(async () => { | ||
btn.click(); | ||
}); | ||
// TODO: Update this test when everything is running in single react app | ||
expect(window.location.pathname).not.toBe('/edit-app/app-1'); | ||
}); | ||
|
||
test('simulates editing an app with an error', async () => { | ||
mock.onGet(new RegExp('/frameworks')).reply(200, frameworks); | ||
mock.onGet(new RegExp('/server/app-1')).reply(200, app); | ||
|
@@ -354,7 +357,6 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
thumbnail="/some-thumbnail.png" | ||
serverStatus="Ready" | ||
/> | ||
|
@@ -371,7 +373,10 @@ describe('AppCard', () => { | |
|
||
const btn = baseElement.querySelectorAll( | ||
'.MuiList-root li.MuiButtonBase-root', | ||
)[0] as HTMLAnchorElement; | ||
)[2] as HTMLAnchorElement; | ||
expect(btn).toBeInTheDocument(); | ||
expect(btn).toHaveTextContent('Edit'); | ||
expect(btn).not.toHaveAttribute('disabled', 'disabled'); | ||
await act(async () => { | ||
btn.click(); | ||
}); | ||
|
@@ -391,7 +396,6 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
thumbnail="/some-thumbnail.png" | ||
serverStatus="Ready" | ||
/> | ||
|
@@ -409,6 +413,9 @@ describe('AppCard', () => { | |
const btn = baseElement.querySelectorAll( | ||
'.MuiList-root li.MuiButtonBase-root', | ||
)[3] as HTMLAnchorElement; | ||
expect(btn).toBeInTheDocument(); | ||
expect(btn).toHaveTextContent('Delete'); | ||
expect(btn).not.toHaveAttribute('disabled', 'disabled'); | ||
await act(async () => { | ||
btn.click(); | ||
}); | ||
|
@@ -426,7 +433,6 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
thumbnail="/some-thumbnail.png" | ||
serverStatus="Ready" | ||
/> | ||
|
@@ -444,6 +450,9 @@ describe('AppCard', () => { | |
const btn = baseElement.querySelectorAll( | ||
'.MuiList-root li.MuiButtonBase-root', | ||
)[3] as HTMLAnchorElement; | ||
expect(btn).toBeInTheDocument(); | ||
expect(btn).toHaveTextContent('Delete'); | ||
expect(btn).not.toHaveAttribute('disabled', 'disabled'); | ||
await act(async () => { | ||
btn.click(); | ||
}); | ||
|
@@ -479,7 +488,6 @@ describe('AppCard', () => { | |
username="Developer" | ||
framework="Some Framework" | ||
url="/some-url" | ||
ready={true} | ||
thumbnail="/some-thumbnail.png" | ||
serverStatus="Ready" | ||
/> | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was something we unnecessarily added when implementing the dummy axios data, to support testing in vercel. It actually is not needed, and is resulting in a lot of unnecessary errors to be logged when running unit tests.