Permalink
Browse files

added missing test file

  • Loading branch information...
1 parent d4e2d54 commit af9dcbc23ef7f86777bb033f5b638278070918de @n1k0 n1k0 committed Dec 28, 2012
Showing with 33 additions and 0 deletions.
  1. +33 −0 tests/suites/pagestack.js
View
@@ -0,0 +1,33 @@
+/*global casper*/
+/*jshint strict:false maxstatements:99*/
+var pagestack = require('pagestack');
+var utils = require('utils');
+var webpage = require('webpage');
+
+casper.test.begin('pagestack module tests', 14, function(test) {
+ var stack = pagestack.create();
+ var page1 = webpage.create();
+ page1.url = 'page1.html';
+ stack.push(page1);
+ test.assertEquals(stack.length, 1);
+ test.assert(utils.isWebPage(stack[0]));
+ test.assertEquals(stack[0], page1);
+ test.assertEquals(stack.list().length, 1);
+ test.assertEquals(stack.list()[0], page1.url);
+
+ var page2 = webpage.create();
+ page2.url = 'page2.html';
+ stack.push(page2);
+ test.assertEquals(stack.length, 2);
+ test.assert(utils.isWebPage(stack[1]));
+ test.assertEquals(stack[1], page2);
+ test.assertEquals(stack.list().length, 2);
+ test.assertEquals(stack.list()[1], page2.url);
+
+ test.assertEquals(stack.clean(page1), 1);
+ test.assertEquals(stack[0], page2);
+ test.assertEquals(stack.list().length, 1);
+ test.assertEquals(stack.list()[0], page2.url);
+
+ test.done();
+});

0 comments on commit af9dcbc

Please sign in to comment.