verify that our version of Otto treats JSON parsed arrays like real arrays
(t *testing.T)
| 52 | |
| 53 | // verify that our version of Otto treats JSON parsed arrays like real arrays |
| 54 | func TestJavaScriptWorks(t *testing.T) { |
| 55 | ctx := base.TestCtx(t) |
| 56 | mapper := NewChannelMapper(ctx, `function(doc) {channel(doc.x.concat(doc.y));}`, 0) |
| 57 | res, err := mapper.MapToChannelsAndAccess(ctx, parse(t, `{"x":["abc"],"y":["xyz"]}`), `{}`, emptyMetaMap(), noUser) |
| 58 | assert.NoError(t, err, "MapToChannelsAndAccess failed") |
| 59 | assert.Equal(t, BaseSetOf(t, "abc", "xyz"), res.Channels) |
| 60 | } |
| 61 | |
| 62 | // Just verify that the calls to the channel() fn show up in the output channel list. |
| 63 | func TestSyncFunction(t *testing.T) { |
nothing calls this directly
no test coverage detected