Skip to content

Commit

Permalink
Add test for valid zoneId name
Browse files Browse the repository at this point in the history
  • Loading branch information
quisquous committed Jul 2, 2020
1 parent c3d7491 commit 5fa47b6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/trigger/test_trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,20 @@ let testBadTimelineTriggerRegex = function(file, contents) {
}
};


let testBadZoneId = function(file, contents) {
let json = eval(contents);
if (!('zoneId' in json[0])) {
console.error(`${file}: missing zone id`);
return;
}

if (typeof json[0].zoneId === 'undefined') {
console.error(`${file}: unknown zone id`);
exitCode = 1;
}
};

let testTriggerFile = function(file) {
let contents = fs.readFileSync(file) + '';

Expand All @@ -422,6 +436,7 @@ let testTriggerFile = function(file) {
testResponseHasNoFriends(file, contents);
testTriggerFieldsSorted(file, contents);
testBadTimelineTriggerRegex(file, contents);
testBadZoneId(file, contents);
} catch (e) {
console.error(`Trigger error in ${file}.`);
console.error(e);
Expand Down

0 comments on commit 5fa47b6

Please sign in to comment.