Skip to content

Commit

Permalink
Merge pull request #101 from dwyl/watch-it-fail-sample-code-issue-100
Browse files Browse the repository at this point in the history
adds "Check Point" of code at first "watch it fail" section
  • Loading branch information
iteles authored Aug 3, 2017
2 parents bcbdc58 + 0fa2c27 commit 8c650f6
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,46 @@ test('getChange(1,1) should equal [] - an empty array', function(assert) {
We use QUnit's `deepEqual` (_assert_) method to check that all the _elements_
in the two arrays are _**identical**_. see: https://api.qunitjs.com/deepEqual/

At this point, your `index.html` file should look like this:

```html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Vending Machine Change Calculator TDD</title>
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-1.18.0.css">
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.6.0/pure-min.css">
</head>
<body>
<div id='main' style='padding: 2em;'>
<h1>Vending Machine Change Calculator</h1>
<h2>Calculate the Change for a Given Price and Cash Received</h2>
</div>

<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="https://code.jquery.com/qunit/qunit-1.18.0.js"></script>

<script>
// your solution will go here!
</script>

<script>
test('getChange(1,1) should equal [] - an empty array', function(assert) {
var result = getChange(1, 1); //no change/coins just an empty array
var expected = [];
assert.deepEqual(result, expected);
}); // use deepEqual for arrays see: https://api.qunitjs.com/deepEqual/
</script>
</body>
</html>
```


#### Watch it _Fail_

Back in your browser window, refresh the browser and watch it *fail*:
Back in your browser window, _refresh_ the browser and watch it *fail*:

![first failing test](http://i.imgur.com/4fuumU1.png)

Expand Down

0 comments on commit 8c650f6

Please sign in to comment.