Skip to content

Commit 9ff606d

Browse files
committed
Section 32: Writing Assertions
1 parent ad931d0 commit 9ff606d

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

32-The-Basics-of-Testing/06-movies/test/autocomplete.test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,7 @@ it('Shows an autocomplete', () => {
1919
// assert.strictEquals(dropdown.className, 'dropdown')
2020

2121
// Mocha inside the browser
22-
22+
expect(dropdown.className).not.to.include('is-active')
23+
// Fail the test
24+
// expect(dropdown.className).to.include('is-active')
2325
})

32-The-Basics-of-Testing/06-movies/test/test.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<script class="mocha-init">
1717
mocha.setup('bdd')
1818
mocha.checkLeaks()
19+
const expect = chai.expect
1920
</script>
2021
<script src="../utils.js"></script>
2122
<script src="../autocomplete.js"></script>

32-The-Basics-of-Testing/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,10 @@
4040

4141
#### Chai.js
4242

43+
https://chaijs.com
4344
Is what we call an expectation library or an assertion library is the library that allows us to use those same kind of assert statements that we saw at that node module.
45+
46+
## 12. 14 Writing Assertions
47+
48+
https://www.chaijs.com/guide/styles/#expect
49+

0 commit comments

Comments
 (0)