Test for CREATE event with substack

This commit is contained in:
Tim Mickel 2016-06-07 10:49:12 -04:00
parent f158af18b1
commit 4eb63cf33e
2 changed files with 35 additions and 0 deletions
test/unit

View file

@ -34,3 +34,27 @@ test('create event', function (t) {
t.end();
});
test('create with substack', function (t) {
var result = adapter(events.createsubstack);
// Outer block
t.type(result[0].id, 'string');
t.type(result[0].opcode, 'string');
t.type(result[0].fields, 'object');
t.type(result[0].inputs, 'object');
t.type(result[0].inputs['SUBSTACK'], 'object');
t.type(result[0].topLevel, 'boolean');
t.equal(result[0].topLevel, true);
// In substack
var substackBlockId = result[0].inputs['SUBSTACK']['block'];
t.type(substackBlockId, 'string');
// Find actual substack block
var substackBlock = null;
for (var i = 0; i < result.length; i++) {
if (result[i].id == substackBlockId) {
substackBlock = result[i];
}
}
t.type(substackBlock, 'object');
t.end();
});