Skip to content

Commit 1e4433b

Browse files
committed
Section 32: Asserting Records Fetched
1 parent ceaded6 commit 1e4433b

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,17 @@ it('After searching, dropdown opens up', async () => {
5454
const dropdown = document.querySelector('.dropdown')
5555
expect(dropdown.className).to.include('is-active')
5656
})
57+
58+
59+
it('After searching, display some results', async () => {
60+
const input = document.querySelector('input')
61+
input.value = 'avengers'
62+
input.dispatchEvent(new Event('input'))
63+
64+
await waitFor('.dropdown-item')
65+
66+
const items = document.querySelectorAll('.dropdown-item')
67+
68+
expect(items.length).to.equal(3)
69+
// expect(items.length).to.equal(4) // This test will fail
70+
})

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,6 @@ Faking the event with mocha
5757

5858
## 14. 16 Holding Up Assertions
5959

60-
## 15. 17 Implementing WaitFor
60+
## 15. 17 Implementing WaitFor
61+
62+
## 16. 18 Asserting Records Fetched

0 commit comments

Comments
 (0)