mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Remove enzyme (#640)
The test that was added is not a good test. If we want to test things, we should be testing logic that is error prone such as all the mouse handling logic and state management. Adding a test for something trivial as displaying a list of data is just going to be annoying when we eventually change the UI and the test breaks. Since this is the only test using enzyme, I also removed enzyme. We can add it back if we want to test a component using it.
This commit is contained in:
parent
e4919e2e6c
commit
ead9aab888
3 changed files with 0 additions and 445 deletions
|
@ -1,52 +0,0 @@
|
|||
import React from "react";
|
||||
import Enzyme, { shallow } from "enzyme";
|
||||
import Adapter from "enzyme-adapter-react-16";
|
||||
import { StoredScenesList } from "./StoredScenesList";
|
||||
import { PreviousScene } from "../scene/types";
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
|
||||
function setup(props: any) {
|
||||
const currentProps = {
|
||||
...props,
|
||||
onChange: jest.fn(),
|
||||
};
|
||||
return {
|
||||
wrapper: shallow(<StoredScenesList {...currentProps} />),
|
||||
props: currentProps,
|
||||
};
|
||||
}
|
||||
|
||||
describe("<StoredScenesList/>", () => {
|
||||
const scenes: PreviousScene[] = [
|
||||
{
|
||||
id: "123",
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
{
|
||||
id: "234",
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
{
|
||||
id: "345",
|
||||
timestamp: Date.now(),
|
||||
},
|
||||
];
|
||||
|
||||
const { wrapper, props } = setup({ scenes });
|
||||
|
||||
describe("Renders the ids correctly when", () => {
|
||||
it("select options and ids length are the same", () => {
|
||||
expect(wrapper.find("option").length).toBe(scenes.length);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Can handle id selection when", () => {
|
||||
it("onChange method is called when select option has changed", async () => {
|
||||
const select = wrapper.find("select") as any;
|
||||
const mockedEvenet = { currentTarget: { value: "1" } };
|
||||
await select.invoke("onChange")(mockedEvenet);
|
||||
expect(props.onChange.mock.calls.length).toBe(1);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue