Skip to content

Commit

Permalink
Unit testing couchdb code.
Browse files Browse the repository at this point in the history
  • Loading branch information
millette committed Aug 24, 2016
1 parent 171a102 commit 74fef92
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test-ddoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
'use strict'
import test from 'ava'
import fn from './ddoc/app/shows/front'
import fn2 from './ddoc/app/views/i1/map'

test('show front', t => {
const doc = {}
const req = {}
const result = fn(doc, req)
t.is(result, '<html><head><meta charset="utf-8"></head><body><p>Hello monde</p><pre>{}</pre><pre>{}</pre>')
})

test('view il', t => {
const doc = { _id: 'le-id', _rev: '1-abc' }
t.plan(2)
fn2(doc, {
emit: (k, v) => {
t.is(k, 'le-id')
t.is(v, '1-abc')
}
})
})

0 comments on commit 74fef92

Please sign in to comment.