-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtests.html
71 lines (66 loc) · 2.97 KB
/
tests.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WOWAPI QUnit tests</title>
<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-git.css">
<script type="text/javascript" src="http://codeorigin.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="wowapi.js"></script>
<script type="text/javascript" src="http://code.jquery.com/qunit/qunit-git.js"></script>
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script>
var wowApiTestInstance = new WOWAPI();
module('Initialization')
test('WOWAPI constructor', function () {
equal(wowApiTestInstance.region, 'eu', 'Region should be "eu');
equal(wowApiTestInstance.locale, 'en_GB', 'Locale should be en_GB');
equal(wowApiTestInstance.API_URL, 'http://eu.battle.net/api/wow/', 'API URL should be http://eu.battle.net/api/wow/');
});
module('API integrity')
asyncTest('getAchievement()', function () {
wowApiTestInstance.getAchievement(2144, function (response) {
start();
equal(response.accountWide, true, 'Achievement should be account wide');
equal(response.criteria.length, 9, 'Achievement should have 9 requirements');
equal(response.description, "Complete the world events achievements listed below.", "Description should match");
equal(response.id, 2144, 'Id should match');
});
});
asyncTest('getBattlePetAbility()', function () {
wowApiTestInstance.getBattlePetAbility(640, function (response) {
start();
equal(response.cooldown, 0, 'Cooldown should match');
equal(response.name, "Toxic Smoke", "Name should match");
equal(response.id, 640, 'Id should match');
});
});
asyncTest('getBattlePetSpecies()', function () {
wowApiTestInstance.getBattlePetSpecies(640, function (response) {
start();
equal(response.abilities.length, 6, 'Number of abilities should match');
equal(response.description, "With the extra large surface area of their legs, snowshoe hares are able to effortlessly hop along the snow while their pursuers get bogged down in the drifts.", "Description should match");
equal(response.name, "Snowshoe Hare", "Name should match");
equal(response.speciesId, 640, 'Id should match');
});
});
asyncTest('getBattlePetStats()', function () {
wowApiTestInstance.getBattlePetStats({
speciesId: 640,
level: 25,
breedId: 3,
qualityId: 1
}, function (response) {
start();
equal(response.breedId, 3, 'Id should match');
equal(response.level, 25, "Level should match");
equal(response.health, 1269, "Health should match");
equal(response.power, 206, "Power should match");
equal(response.speciesId, 640, 'Id should match');
});
});
</script>
</body>
</html>