Commit af9dcbc2 af9dcbc23ef7f86777bb033f5b638278070918de by Nicolas Perriault

added missing test file

1 parent d4e2d545
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 });