
horneber
Test-Driven React 2: Tests have incorrect assertions (Page 108/109)
All three tests expect the same URL. One test does not use any button, one test moves forward, one backwards in the slide deck. Tests-as-written fail and rightly so.
Edit: never mind. Of course the URL stays the same as the callback doesn’t do anything, so there is no state. The tests failed for reasons of my own doing. Sorry for the noise!
Then again, it might be worth pointing out the fact that the URLs don’t change between all tests. At first glance that seems counter-intuitive. Maybe when discussing vite’s mock function implementing the onSlideIndexChange
handler?
First Post!

TrevorBurnham
Thanks for the feedback! The “no change” assertion in those tests is to verify that the carousel’s internal logic has no effect on which slide is shown when the slideIndex
prop is set. I’ll try to clarify that.
Popular Pragmatic Bookshelf topics










Other popular topics










Categories:
Sub Categories:
Popular Portals
- /elixir
- /rust
- /wasm
- /ruby
- /erlang
- /phoenix
- /keyboards
- /rails
- /js
- /python
- /security
- /go
- /swift
- /vim
- /clojure
- /java
- /haskell
- /emacs
- /svelte
- /onivim
- /typescript
- /crystal
- /c-plus-plus
- /tailwind
- /kotlin
- /gleam
- /react
- /flutter
- /elm
- /ocaml
- /ash
- /vscode
- /opensuse
- /centos
- /php
- /deepseek
- /html
- /scala
- /zig
- /debian
- /nixos
- /lisp
- /agda
- /textmate
- /react-native
- /sublime-text
- /kubuntu
- /arch-linux
- /revery
- /ubuntu
- /manjaro
- /spring
- /django
- /diversity
- /nodejs
- /lua
- /c
- /slackware
- /julia
- /neovim