added missing test file
Showing
1 changed file
with
33 additions
and
0 deletions
tests/suites/pagestack.js
0 → 100644
1 | /*global casper*/ | ||
2 | /*jshint strict:false maxstatements:99*/ | ||
3 | var pagestack = require('pagestack'); | ||
4 | var utils = require('utils'); | ||
5 | var webpage = require('webpage'); | ||
6 | |||
7 | casper.test.begin('pagestack module tests', 14, function(test) { | ||
8 | var stack = pagestack.create(); | ||
9 | var page1 = webpage.create(); | ||
10 | page1.url = 'page1.html'; | ||
11 | stack.push(page1); | ||
12 | test.assertEquals(stack.length, 1); | ||
13 | test.assert(utils.isWebPage(stack[0])); | ||
14 | test.assertEquals(stack[0], page1); | ||
15 | test.assertEquals(stack.list().length, 1); | ||
16 | test.assertEquals(stack.list()[0], page1.url); | ||
17 | |||
18 | var page2 = webpage.create(); | ||
19 | page2.url = 'page2.html'; | ||
20 | stack.push(page2); | ||
21 | test.assertEquals(stack.length, 2); | ||
22 | test.assert(utils.isWebPage(stack[1])); | ||
23 | test.assertEquals(stack[1], page2); | ||
24 | test.assertEquals(stack.list().length, 2); | ||
25 | test.assertEquals(stack.list()[1], page2.url); | ||
26 | |||
27 | test.assertEquals(stack.clean(page1), 1); | ||
28 | test.assertEquals(stack[0], page2); | ||
29 | test.assertEquals(stack.list().length, 1); | ||
30 | test.assertEquals(stack.list()[0], page2.url); | ||
31 | |||
32 | test.done(); | ||
33 | }); |
-
Please register or sign in to post a comment