From 4283b1263c411fd9fae9d653de9b01fdb68d713e Mon Sep 17 00:00:00 2001 From: Alexander Yakovlev Date: Fri, 16 Jun 2017 20:28:31 +0700 Subject: [PATCH] Autotesting for possible bugs --- test/index.html | 35 +++++++++++++++++++++++++++++++++++ test/tests/main.js | 19 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 test/index.html create mode 100644 test/tests/main.js diff --git a/test/index.html b/test/index.html new file mode 100644 index 0000000..8c940c9 --- /dev/null +++ b/test/index.html @@ -0,0 +1,35 @@ + + + + + + + + + + +
+
+ +
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + + diff --git a/test/tests/main.js b/test/tests/main.js new file mode 100644 index 0000000..30f1d47 --- /dev/null +++ b/test/tests/main.js @@ -0,0 +1,19 @@ +salet.autosave = false; +salet.autoload = false; + +$(document).ready(function() { + QUnit.test("The game starts okay.", function(assert) { + assert.notEqual(salet, void 0, "Salet is initialized"); + return assert.equal(salet.current, "start", "Salet is in the room called 'start'"); + }); + QUnit.test("There are no game-breaking bugs when entering rooms.", 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]; + + assert.ok(salet.goTo(room.name), "Entered room "+room.name); + } + }); +});