Skip to content

Commit 5fa47b6

Browse files
committed
Add test for valid zoneId name
1 parent c3d7491 commit 5fa47b6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/trigger/test_trigger.js

+15
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,20 @@ let testBadTimelineTriggerRegex = function(file, contents) {
404404
}
405405
};
406406

407+
408+
let testBadZoneId = function(file, contents) {
409+
let json = eval(contents);
410+
if (!('zoneId' in json[0])) {
411+
console.error(`${file}: missing zone id`);
412+
return;
413+
}
414+
415+
if (typeof json[0].zoneId === 'undefined') {
416+
console.error(`${file}: unknown zone id`);
417+
exitCode = 1;
418+
}
419+
};
420+
407421
let testTriggerFile = function(file) {
408422
let contents = fs.readFileSync(file) + '';
409423

@@ -422,6 +436,7 @@ let testTriggerFile = function(file) {
422436
testResponseHasNoFriends(file, contents);
423437
testTriggerFieldsSorted(file, contents);
424438
testBadTimelineTriggerRegex(file, contents);
439+
testBadZoneId(file, contents);
425440
} catch (e) {
426441
console.error(`Trigger error in ${file}.`);
427442
console.error(e);

0 commit comments

Comments
 (0)