Do you write tests for DOM interactions? [JS]

1 points by aldnoahzero ↗ HN
I'm new to writing tests and after learning about unit testing etc, I started writing tests for my app.

I keep getting the nagging feeling that I'm doing something worng here and I'm adding tests for the sake of writing tests. I don't have anyone in my office to ask this.

Below are the tests myself and my coworkers wrote:

1) There's a search bar that gives suggestions as the user types a word (similar to google). For this, I used an array of names as mockdata and test if the suggestions are appearing properly by checking the DOM. I'm using underscore#filter to filter my array.

2) A page with list of values. I wrote a test with array of values as mockdata and test if there are correct dom elements corresponding to the array. (This feels plain silly, not written by me)

3) Many tests are about using a backbone 'class' and seeing if instanstiating creates an object of type 'object'

What do you test in your application? Are there any good sources (github/bitbucket) to learn more about how 'normal' devs write tests?

Thanks in advance.

0 comments

[ 3.3 ms ] story [ 11.4 ms ] thread

No comments yet.