mirror of
https://gitlab.com/Oreolek/salet.git
synced 2024-05-04 01:59:39 +03:00
Autotesting for possible bugs
This commit is contained in:
parent
01e1a24ff5
commit
4283b1263c
35
test/index.html
Normal file
35
test/index.html
Normal file
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.3.3.css">
|
||||
<style>#page{display: none}</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="page" class="container">
|
||||
<div class="row">
|
||||
<ul class="nav nav-pills" id="ways"></ul>
|
||||
<div id="content_wrapper">
|
||||
<div id="content" class="content">
|
||||
</div>
|
||||
<a name="end_of_content"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
|
||||
<!-- Dependency JS Libraries -->
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.5/marked.min.js" crossorigin="anonymous"></script>
|
||||
<script src="https://code.jquery.com/jquery-3.1.1.min.js" crossorigin="anonymous"></script>
|
||||
<script src="https://code.jquery.com/qunit/qunit-2.3.3.js"></script>
|
||||
|
||||
<script src="../build/game/salet.min.js"></script>
|
||||
<script src="../build/game/main.js"></script>
|
||||
|
||||
<script src="tests/main.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
19
test/tests/main.js
Normal file
19
test/tests/main.js
Normal file
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue