Skip to content
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.

pass tests #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all 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
32 changes: 19 additions & 13 deletions index.test.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
const reactTestRenderer = require('react-test-renderer')
const MyComponent = require('./index.js')
const React = require('react')
let React;

describe('MyComponent', () => {
it('should render without errors', () => {
reactTestRenderer.create(React.createElement(MyComponent, {})).toJSON()
})
it('should render without errors when imported after resetModules called', () => {
jest.resetModules()
const MyComponent = require('./index.js')
reactTestRenderer.create(React.createElement(MyComponent, {})).toJSON()
})
})
let ReactTestRenderer;
let MyComponent;

describe("MyComponent", () => {
beforeEach(() => {
jest.resetModules();

MyComponent = require("./index.js");
React = require("react");
ReactTestRenderer = require("react-test-renderer");
});
it("should render without errors", () => {
ReactTestRenderer.create(React.createElement(MyComponent, {})).toJSON();
});
it("should render without errors when imported after resetModules called", () => {
ReactTestRenderer.create(React.createElement(MyComponent, {})).toJSON();
});
});