☕️ Classic, reliable, trusted test framework for Node.js and the browser
array.js
Tj Holowaychuk491c0c45c576
diff --git a/test/browser/array.js b/test/browser/array.jsnew file mode 100644index 00000000..388149e7--- /dev/null+++ b/test/browser/array.js@@ -0,0 +1,33 @@+describe('Array', function(){+ describe('#indexOf()', function(){+ it('should return -1 when the value is not present', function(){+ var arr = [1,2,3];+ assert(-1 == arr.indexOf(5));+ })++ it('should return the correct index when the value is present', function(){+ var arr = [1,2,3];+ assert(0 == arr.indexOf(1)); // just to test indentation+ assert(1 == arr.indexOf(2));+ })+ })+})++describe('Array', function(){+ describe('#pop()', function(){+ it('should remove and return the last value', function(){+ var arr = [1,2,3];+ assert(arr.pop() == 3);+ })+ })+})++describe('Array', function(){+ describe('#pop()', function(){+ it('should adjust .length', function(){+ var arr = [1,2,3];+ arr.pop();+ assert(arr.length == 2);+ })+ })+})\ No newline at end of filediff --git a/test/browser/index.html b/test/browser/index.htmlindex f2495932..cd2509a8 100644--- a/test/browser/index.html+++ b/test/browser/index.html@@ -4,45 +4,11 @@<script src="../../mocha.js"></script><link rel="stylesheet" href="style.css" /><script>-function assert(expr, msg) {if (!expr) throw new Error(msg || 'failed');}-- describe('Array', function(){- describe('#indexOf()', function(){- it('should return -1 when the value is not present', function(){- var arr = [1,2,3];- assert(-1 == arr.indexOf(5));- })-- it('should return the correct index when the value is present', function(){- var arr = [1,2,3];- assert(0 == arr.indexOf(1)); // just to test indentation- assert(1 == arr.indexOf(2));- })- })- })-- describe('Array', function(){- describe('#pop()', function(){- it('should remove and return the last value', function(){- var arr = [1,2,3];- assert(arr.pop() == 3);- })- })- })-- describe('Array', function(){- describe('#pop()', function(){- it('should adjust .length', function(){- var arr = [1,2,3];- arr.pop();- assert(arr.length == 2);- })- })- })</script>+ <script src="array.js"></script></head><body><div id="mocha"></div>