forked from mushmelow/basic-javascript-workshop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbubbleSort.js
More file actions
21 lines (16 loc) · 653 Bytes
/
Copy pathbubbleSort.js
File metadata and controls
21 lines (16 loc) · 653 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var expect = require('chai').expect;
var bubbleSort = require('../workshop').bubbleSort;
describe('bubbleSort', function() {
it('Should sort numbers in order', function() {
expect(bubbleSort([3,1,2])).to.deep.equal([1,2,3]);
});
it('Should work with repeated numbers', function() {
expect(bubbleSort([2,3,3,1,2,4])).to.deep.equal([1,2,2,3,3,4]);
});
it('Should work with a single-element array', function() {
expect(bubbleSort([42])).to.deep.equal([42]);
});
it('Should work with an empty array', function() {
expect(bubbleSort([])).to.equal([]); // could this test be broken?
});
});