From 4809aeb39081a32877c0d8258741ed5312b360c8 Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Fri, 16 Jun 2017 20:40:07 +0700 Subject: [PATCH] Action check --- test/tests/main.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/tests/main.js b/test/tests/main.js index 30f1d47..95305ac 100644 --- a/test/tests/main.js +++ b/test/tests/main.js @@ -16,4 +16,21 @@ $(document).ready(function() { assert.ok(salet.goTo(room.name), "Entered room "+room.name); } }); + QUnit.test("There are no game-breaking bugs in all actions.", function(assert) { + for (var key in salet.rooms) { + // skip loop if the property is from prototype + if (!salet.rooms.hasOwnProperty(key)) continue; + var room = salet.rooms[key]; + + salet.goTo(room.name); + for (var act in room.actions) { + if (!room.actions.hasOwnProperty(act)) continue; + assert.ok(act.fcall(room), "Executed action "+act); + } + for (var act in room.writers) { + if (!room.writers.hasOwnProperty(act)) continue; + assert.ok(act.fcall(room), "Executed action "+act); + } + } + }); });