Last active
October 12, 2016 09:51
-
-
Save traverse/51e26d2dfb9b935a71df to your computer and use it in GitHub Desktop.
Learning unit testing with Mocha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var strings = require("./strings"); | |
var assert = require("assert"); | |
describe("strings module", function() { | |
it("should dash separate camelCase string with one capital", function() { | |
var camel = "sampleString"; | |
var expected = "sample-string"; | |
var dashed = strings.dashSeparated(camel); | |
assert.equal(dashed, expected); | |
}); | |
it("should dash separate camelCase string with multiple capitals", function() { | |
var camel = "sampleStringWithMultipleCapitals"; | |
var expected = "sample-string-with-multiple-capitals"; | |
var dashed = strings.dashSeparated(camel); | |
assert.equal(dashed, expected); | |
}); | |
it("should dash separate camelCase string with numbers", function() { | |
var camel = "sampleString1234"; | |
var expected = "sample-string-1234"; | |
var dashed = strings.dashSeparated(camel); | |
assert.equal(dashed, expected); | |
}); | |
it("should dash seperate camelCase string with numbers in the middle", function() { | |
var camel = "sample1234String"; | |
var expected = "sample-1234-string"; | |
var dashed = strings.dashSeparated(camel); | |
assert.equal(dashed, expected); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment