Skip to content

Commit

Permalink
Merge pull request #784 from PacoVK/upgrade-and-tests
Browse files Browse the repository at this point in the history
Upgrade and tests
  • Loading branch information
PacoVK authored Dec 1, 2023
2 parents ad0ab31 + cb24f51 commit 93080b6
Show file tree
Hide file tree
Showing 20 changed files with 2,219 additions and 1,016 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/frontend.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Frontend tests
on: push

defaults:
run:
working-directory: frontend

jobs:
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: prepare
run: yarn install
- name: test
run: yarn test
2 changes: 1 addition & 1 deletion .github/workflows/server.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
container: golang
services:
localstack:
image: localstack/localstack:1.0.4
image: localstack/localstack
env:
SERVICES: sqs
EXTRA_CORS_ALLOWED_ORIGINS: "*"
Expand Down
10 changes: 10 additions & 0 deletions frontend/components/Alert.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { render } from "@testing-library/react";
import Alert from "./Alert";

describe("<Alert /> spec", () => {
it("renders the Alert", () => {
const view = render(<Alert message={"Hello"} severity={"info"} onClose={() => {}} />);
expect(view).toMatchSnapshot();

});
});
10 changes: 10 additions & 0 deletions frontend/components/CreateQueueDialog.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { render } from "@testing-library/react";
import CreateQueueDialog from "./CreateQueueDialog";

describe("<CreateQueueDialog /> spec", () => {
it("renders the CreateQueueDialog", () => {
const view = render(<CreateQueueDialog onSubmit={() => {}} />);
expect(view).toMatchSnapshot();

});
});
14 changes: 14 additions & 0 deletions frontend/components/MessageItem.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { render } from "@testing-library/react";
import MessageItem from "./MessageItem";

describe("<MessageItem /> spec", () => {
it("renders the MessageItem", () => {
const view = render(<MessageItem data={{
messageBody: "Hello",
messageAttributes: {
SentTimestamp: "fake",
}
}} />);
expect(view).toMatchSnapshot();
});
});
17 changes: 17 additions & 0 deletions frontend/components/SendMessageDialog.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { render } from "@testing-library/react";
import SendMessageDialog from "./SendMessageDialog";
import {Queue} from "../types";

describe("<SendMessageDialog /> spec", () => {
it("renders the SendMessageDialog", () => {
const queue: Queue = {
QueueName: "test"
}
const view = render(<div>
<SendMessageDialog disabled={false} onSubmit={()=>{}} queue={queue} />
<SendMessageDialog disabled={true} onSubmit={()=>{}} queue={queue} />
</div>);
expect(view).toMatchSnapshot();

});
});
12 changes: 12 additions & 0 deletions frontend/components/TabPanel.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { render } from "@testing-library/react";
import TabPanel from "./TabPanel";

describe("<TabPanel /> spec", () => {
it("renders the TabPanel", () => {
const view = render(<TabPanel index={0} value={0}>
<div>Test</div>
</TabPanel>);
expect(view).toMatchSnapshot();

});
});
190 changes: 190 additions & 0 deletions frontend/components/__snapshots__/Alert.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<Alert /> spec renders the Alert 1`] = `
Object {
"asFragment": [Function],
"baseElement": <body>
<div>
<div
class="MuiCollapse-root MuiCollapse-vertical MuiCollapse-entered css-pwcg7p-MuiCollapse-root"
style="min-height: 0px;"
>
<div
class="MuiCollapse-wrapper MuiCollapse-vertical css-smkl36-MuiCollapse-wrapper"
>
<div
class="MuiCollapse-wrapperInner MuiCollapse-vertical css-9l5vo-MuiCollapse-wrapperInner"
>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root MuiAlert-standardInfo MuiAlert-standard css-ethv1g-MuiPaper-root-MuiAlert-root"
role="alert"
>
<div
class="MuiAlert-icon css-1ytlwq5-MuiAlert-icon"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1vooibu-MuiSvgIcon-root"
data-testid="InfoOutlinedIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"
/>
</svg>
</div>
<div
class="MuiAlert-message css-1pxa9xg-MuiAlert-message"
>
Hello
</div>
<div
class="MuiAlert-action css-ki1hdl-MuiAlert-action"
>
<button
aria-label="close"
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit MuiIconButton-sizeSmall css-1e0d89p-MuiButtonBase-root-MuiIconButton-root"
tabindex="0"
type="button"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1vooibu-MuiSvgIcon-root"
data-testid="CloseIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
/>
</svg>
<span
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
</body>,
"container": <div>
<div
class="MuiCollapse-root MuiCollapse-vertical MuiCollapse-entered css-pwcg7p-MuiCollapse-root"
style="min-height: 0px;"
>
<div
class="MuiCollapse-wrapper MuiCollapse-vertical css-smkl36-MuiCollapse-wrapper"
>
<div
class="MuiCollapse-wrapperInner MuiCollapse-vertical css-9l5vo-MuiCollapse-wrapperInner"
>
<div
class="MuiPaper-root MuiPaper-elevation MuiPaper-rounded MuiPaper-elevation0 MuiAlert-root MuiAlert-standardInfo MuiAlert-standard css-ethv1g-MuiPaper-root-MuiAlert-root"
role="alert"
>
<div
class="MuiAlert-icon css-1ytlwq5-MuiAlert-icon"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1vooibu-MuiSvgIcon-root"
data-testid="InfoOutlinedIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"
/>
</svg>
</div>
<div
class="MuiAlert-message css-1pxa9xg-MuiAlert-message"
>
Hello
</div>
<div
class="MuiAlert-action css-ki1hdl-MuiAlert-action"
>
<button
aria-label="close"
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit MuiIconButton-sizeSmall css-1e0d89p-MuiButtonBase-root-MuiIconButton-root"
tabindex="0"
type="button"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeInherit css-1vooibu-MuiSvgIcon-root"
data-testid="CloseIcon"
focusable="false"
viewBox="0 0 24 24"
>
<path
d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
/>
</svg>
<span
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</button>
</div>
</div>
</div>
</div>
</div>
</div>,
"debug": [Function],
"findAllByAltText": [Function],
"findAllByDisplayValue": [Function],
"findAllByLabelText": [Function],
"findAllByPlaceholderText": [Function],
"findAllByRole": [Function],
"findAllByTestId": [Function],
"findAllByText": [Function],
"findAllByTitle": [Function],
"findByAltText": [Function],
"findByDisplayValue": [Function],
"findByLabelText": [Function],
"findByPlaceholderText": [Function],
"findByRole": [Function],
"findByTestId": [Function],
"findByText": [Function],
"findByTitle": [Function],
"getAllByAltText": [Function],
"getAllByDisplayValue": [Function],
"getAllByLabelText": [Function],
"getAllByPlaceholderText": [Function],
"getAllByRole": [Function],
"getAllByTestId": [Function],
"getAllByText": [Function],
"getAllByTitle": [Function],
"getByAltText": [Function],
"getByDisplayValue": [Function],
"getByLabelText": [Function],
"getByPlaceholderText": [Function],
"getByRole": [Function],
"getByTestId": [Function],
"getByText": [Function],
"getByTitle": [Function],
"queryAllByAltText": [Function],
"queryAllByDisplayValue": [Function],
"queryAllByLabelText": [Function],
"queryAllByPlaceholderText": [Function],
"queryAllByRole": [Function],
"queryAllByTestId": [Function],
"queryAllByText": [Function],
"queryAllByTitle": [Function],
"queryByAltText": [Function],
"queryByDisplayValue": [Function],
"queryByLabelText": [Function],
"queryByPlaceholderText": [Function],
"queryByRole": [Function],
"queryByTestId": [Function],
"queryByText": [Function],
"queryByTitle": [Function],
"rerender": [Function],
"unmount": [Function],
}
`;
84 changes: 84 additions & 0 deletions frontend/components/__snapshots__/CreateQueueDialog.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`<CreateQueueDialog /> spec renders the CreateQueueDialog 1`] = `
Object {
"asFragment": [Function],
"baseElement": <body>
<div>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium css-sghohy-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
Create Queue
<span
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</button>
</div>
</body>,
"container": <div>
<button
class="MuiButtonBase-root MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium MuiButton-root MuiButton-contained MuiButton-containedPrimary MuiButton-sizeMedium MuiButton-containedSizeMedium css-sghohy-MuiButtonBase-root-MuiButton-root"
tabindex="0"
type="button"
>
Create Queue
<span
class="MuiTouchRipple-root css-8je8zh-MuiTouchRipple-root"
/>
</button>
</div>,
"debug": [Function],
"findAllByAltText": [Function],
"findAllByDisplayValue": [Function],
"findAllByLabelText": [Function],
"findAllByPlaceholderText": [Function],
"findAllByRole": [Function],
"findAllByTestId": [Function],
"findAllByText": [Function],
"findAllByTitle": [Function],
"findByAltText": [Function],
"findByDisplayValue": [Function],
"findByLabelText": [Function],
"findByPlaceholderText": [Function],
"findByRole": [Function],
"findByTestId": [Function],
"findByText": [Function],
"findByTitle": [Function],
"getAllByAltText": [Function],
"getAllByDisplayValue": [Function],
"getAllByLabelText": [Function],
"getAllByPlaceholderText": [Function],
"getAllByRole": [Function],
"getAllByTestId": [Function],
"getAllByText": [Function],
"getAllByTitle": [Function],
"getByAltText": [Function],
"getByDisplayValue": [Function],
"getByLabelText": [Function],
"getByPlaceholderText": [Function],
"getByRole": [Function],
"getByTestId": [Function],
"getByText": [Function],
"getByTitle": [Function],
"queryAllByAltText": [Function],
"queryAllByDisplayValue": [Function],
"queryAllByLabelText": [Function],
"queryAllByPlaceholderText": [Function],
"queryAllByRole": [Function],
"queryAllByTestId": [Function],
"queryAllByText": [Function],
"queryAllByTitle": [Function],
"queryByAltText": [Function],
"queryByDisplayValue": [Function],
"queryByLabelText": [Function],
"queryByPlaceholderText": [Function],
"queryByRole": [Function],
"queryByTestId": [Function],
"queryByText": [Function],
"queryByTitle": [Function],
"rerender": [Function],
"unmount": [Function],
}
`;
Loading

0 comments on commit 93080b6

Please sign in to comment.