Skip to content
Browse files

[test refactor] Merge test/gh-1-regression-test.js into test/cliff-te…

…st.js
  • Loading branch information...
1 parent 5d8bf75 commit a7dac3a75e96b8e103943c38cfcba6f4ec4f9bea @indexzero indexzero committed Jan 22, 2012
Showing with 42 additions and 53 deletions.
  1. +42 −11 test/cliff-test.js
  2. +0 −42 test/gh-1-regression-test.js
View
53 test/cliff-test.js
@@ -29,19 +29,50 @@ vows.describe('cliff').addBatch({
}
},
"the arrayLengths() method": {
- "should respond with a list of the longest elements": function () {
- var lengths, rows = [
- ["1a", "2a", "3a", "4a"],
- ["1b", "2bb", "3b", "4b"],
- ["1c", "2c", "3ccc", "4c"],
- ["1d", "2d", "3dd", "4dddd"]
+ "with a set of strings": {
+ "should respond with a list of the longest elements": function () {
+ var lengths, rows = [
+ ["1a", "2a", "3a", "4a"],
+ ["1b", "2bb", "3b", "4b"],
+ ["1c", "2c", "3ccc", "4c"],
+ ["1d", "2d", "3dd", "4dddd"]
+ ];
+
+ lengths = cliff.arrayLengths(rows);
+ assert.equal(lengths[0], 2);
+ assert.equal(lengths[1], 3);
+ assert.equal(lengths[2], 4);
+ assert.equal(lengths[3], 5);
+ }
+ },
+ "with a set of numbers and strings": {
+ "should respond with a list of the longest elements": function () {
+ var lengths, rows = [
+ [11, "2a", "3a", "4a"],
+ ["1b", 222, "3b", "4b"],
+ ["1c", "2c", 3333, "4c"],
+ ["1d", "2d", "3dd", 44444]
+ ];
+
+ lengths = cliff.arrayLengths(rows);
+ assert.equal(lengths[0], 2);
+ assert.equal(lengths[1], 3);
+ assert.equal(lengths[2], 4);
+ assert.equal(lengths[3], 5);
+ }
+ }
+ },
+ "the stringifyRows() method": {
+ "should calculate padding correctly for numbers": function() {
+ var rows = [
+ ['a', 'b'],
+ [12345, 1]
];
- lengths = cliff.arrayLengths(rows);
- assert.equal(lengths[0], 2);
- assert.equal(lengths[1], 3);
- assert.equal(lengths[2], 4);
- assert.equal(lengths[3], 5);
+ assert.equal(
+ cliff.stringifyRows(rows),
+ 'a b \n12345 1 '
+ );
}
}
}
View
42 test/gh-1-regression-test.js
@@ -1,42 +0,0 @@
-/*
- * gh-1-regression-test.js:
- *
- * (C) 2010, Nodejitsu Inc.
- *
- */
-
-var assert = require('assert'),
- vows = require('vows'),
- eyes = require('eyes'),
- cliff = require('../lib/cliff');
-
-vows.describe('cliff/gh-1 regression').addBatch({
- "When using cliff module": {
- "the arrayLengths() method called with numbers in rows": {
- "should respond with a list of the longest elements": function () {
- var lengths, rows = [
- [11, "2a", "3a", "4a"],
- ["1b", 222, "3b", "4b"],
- ["1c", "2c", 3333, "4c"],
- ["1d", "2d", "3dd", 44444]
- ];
-
- lengths = cliff.arrayLengths(rows);
- assert.equal(lengths[0], 2);
- assert.equal(lengths[1], 3);
- assert.equal(lengths[2], 4);
- assert.equal(lengths[3], 5);
- }
- },
- "the stringifyRows() method": {
- "should calculate padding correctly for numbers": function() {
- var rows = [
- ['a', 'b'],
- [12345, 1]
- ],
- output = cliff.stringifyRows(rows);
- assert.equal(output, 'a b \n12345 1 ');
- }
- }
- }
-}).export(module);

0 comments on commit a7dac3a

Please sign in to comment.
Something went wrong with that request. Please try again.