voteliquid / sf-legislation

Parse SF Board of Supervisor agendas
https://github.com/liquidvote/sf-legislation/tree/master/json
2 stars 1 forks source link

Use a real test framework #1

Open dsernst opened 7 years ago

dsernst commented 7 years ago

Instead of re-inventing the wheel with console.log + throw.

dsernst commented 7 years ago

Here's the relevant part of test.js:

      const expected = JSON.stringify(storedJSON[index][field])
      const actual = JSON.stringify(bill[field])

      if (expected !== actual) {
        console.log('Expected:', expected)
        console.log('Actual:', actual)
        console.log()

        throw new Error(`PARSE EXPECTATION FAILURE: agenda[${index}][${field}]`)
      }