couchbaselabs/sync_gateway — pull request #48 by march44 (2013-03-28 22:34:45+00:00)
Title: Added test for channel mapper fn that uses _ underscore library

// channel mapper fn that uses _ underscore JS library
func TestChannelMapperUnderscoreLib(t *testing.T) {
mapper, err := NewChannelMapper(`function(doc) {channel(_.first(doc.channels));}`)
assertNoError(t, err, "Couldn't create mapper")
res, err := mapper.callMapper(`{"channels": ["foo", "bar", "baz"]}`, `{}`, noUser)
assertNoError(t, err, "callMapper failed")
assert.DeepEquals(t, res.Channels, SetOf("foo"))
}