Skip to content

Commit

Permalink
Use var in lesson 17
Browse files Browse the repository at this point in the history
  • Loading branch information
kay-is committed Oct 6, 2018
1 parent 47a9a92 commit d20a23d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions 17-unit-testing.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
mocha.setup("bdd");

// a simple component. It would normally be imported from another file
const MyComponent = () => (
var MyComponent = () => (
<div>
<span className="heading">Title</span>
</div>
Expand All @@ -40,11 +40,11 @@
describe("Component", () => {
it("should render", () => {
// a new renderer is created and used to render the component
const renderer = new ReactShallowRenderer();
var renderer = new ReactShallowRenderer();
renderer.render(<MyComponent />);

// result here should look quiet familiar from lesson 00
let result = renderer.getRenderOutput();
var result = renderer.getRenderOutput();

// now you can traverse the result and check it for correctness
expect(result.type).toBe("div");
Expand All @@ -62,15 +62,15 @@

// here we use the mock part of Jest stand-alone
// normally this is part of the global "jest" object
const jest = window["jest-mock"];
var jest = window["jest-mock"];

// mocking a function to test callback behaviour
const mockCallback = jest.fn();
var mockCallback = jest.fn();

describe("Callback", () => {
it("should be called two times", () => {
// a test function that calls a callback two times
const callCallback = c => {
var callCallback = c => {
c();
c();
};
Expand All @@ -84,4 +84,4 @@

mocha.checkLeaks();
mocha.run();
</script>
</script>

0 comments on commit d20a23d

Please sign in to comment.