Last active
June 27, 2018 04:00
-
-
Save cartant/d519d7660d962d9e3f24f62ffe4c8e98 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import { mount } from "enzyme"; | |
| import * as React from "react"; | |
| import { fakeSchedulers } from "rxjs-marbles/jest"; | |
| import { SomeComponent } from "./SomeComponent"; | |
| describe("SomeComponent", () => { | |
| beforeEach(() => jest.useFakeTimers()); | |
| it("should indicate when searching", fakeSchedulers(advance => { | |
| const wrapper = mount(<SomeComponent />); | |
| expect(wrapper.find('.searching')).toHaveLength(0); | |
| wrapper.find("input").simulate("change", { target: { value: "foo" } }); | |
| advance(400); | |
| wrapper.update(); | |
| expect(wrapper.find('.searching')).toHaveLength(1); | |
| expect(wrapper.find(".searching").html()).toMatch(/foo/); | |
| })); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment