Skip to content
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

Test components #42

Merged
merged 6 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion skyline-vscode/react-ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import MemThroughputContainer from './sections/MemThroughputContainer';
function acquireApi() {
// if (typeof this.acquireApi.api == 'undefined') {
if (typeof acquireApi.api === 'undefined') {
console.log("Calling acquire function");
if (typeof acquireVsCodeApi === "function") {
let f = window['acquireVsCodeApi'];
let a = f();
Expand Down
17 changes: 7 additions & 10 deletions skyline-vscode/react-ui/src/App.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import {act, create} from 'react-test-renderer';
import { render, screen } from "@testing-library/react";
import App from './App';

describe('App', () => {
it ('should render successfully', () => {
let root;
act(() => {
root = create(<App />);
});
expect(root).toBeTruthy();
});
});
test("Render App correctly, it must show begin analysis button", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment isn't necessarily true as it will be disconnected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the comment and testing title

render(<App />);
// For testing there is no default socket connection. It will show the warning screen

expect(screen.getByText(/connection has been lost to the profiler. please reconnect the profiler and double check your ports then click connect/i)).toBeTruthy();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just double check if the App renders something instead of relying on a string. That seems very brittle

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added reconnect button to the test

})
Loading