nodeconf / oslo

Single-day, single-track Node.js conference in Oslo, Norway
http://oslo.nodeconf.com/
17 stars 4 forks source link

Test Everything: My life as well tested code #68

Closed janecakemaster closed 7 years ago

janecakemaster commented 8 years ago

Well tested code is the bestest code. So I am writing some tests about my life that run periodically, notifying me when I've achieved goals or warning me about a bad day ahead because underslept. Once you write enough tests you'll be in total control of your life [1]! We'll explore different testing styles and frameworks, best practices, and neat tips to help you get the most out of your tests. Should you be adopting TDD or BDD?

test('late bedtime', (t) => {
  me.sleep(new Date('February 23, 2016 01:30:00')
  me.awake(new Date('February 23, 2016 06:30:00')

  t.ok(me.wellRested) // fail, get some more sleep
})

test('drinks', (t) => {
  me.drink(['pickleback', 'pickleback', 'pickleback', 'pickleback']) // PICKLE PARTY 

  t.equal(me.tomorrow.status, 'healthy') // me.tomorrow.status = 'hungover', fail
})

test('productivity', (t) => {
  me.code(getGithubData()) // how much did i push today?

  t.equal(me.goals.tenX, 10) // am i cool yet
})

[1] disclaimer: 100% coverage not guaranteed.

Notes

the code snippet is just an idea of what the test suites will probably look like, project is WIP