Skip to content

Commit

Permalink
Added tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
shimaore committed Sep 14, 2014
1 parent a7396af commit a9e9d41
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
node_modules/
49 changes: 32 additions & 17 deletions package.json
@@ -1,20 +1,35 @@
{
"name": "password"
, "version": "0.1.0"
, "description": "Memorable passwords generator"
, "license": "UNLICENSE"
, "keywords": ["password","generator"]
, "author": { "name": "Stephane Alnet", "email": "stephane@shimaore.net" }
, "repository": {
"type": "git"
, "url": "https://github.com/shimaore/password.git"
"name": "password",
"version": "0.1.0",
"description": "Memorable passwords generator",
"license": "UNLICENSE",
"keywords": [
"password",
"generator"
],
"author": {
"name": "Stephane Alnet",
"email": "stephane@shimaore.net"
},
"repository": {
"type": "git",
"url": "https://github.com/shimaore/password.git"
},
"homepage": "https://github.com/shimaore/password",
"main": "lib/password.js",
"files": [
"lib/password.js",
"lib/wordlist.json"
],
"scripts": {
"prepublish": "coffee -c lib/password.coffee",
"test": "mocha --compilers coffee:coffee-script/register --reporter spec"
},
"private": false,
"ok": true,
"devDependencies": {
"coffee-script": "^1.8.0",
"mocha": "^1.21.4",
"should": "^4.0.4"
}
, "homepage": "https://github.com/shimaore/password"
, "main": "lib/password.js"
, "files": ["lib/password.js","lib/wordlist.json"]
, "scripts": {
"prepublish": "coffee -c lib/password.coffee"
}
, "private": false
, "ok": true
}
18 changes: 18 additions & 0 deletions test/tests.coffee
@@ -0,0 +1,18 @@
password = require '..'

should = require 'should'

describe 'Password', ->
it 'should return a string when called with a number', ->
password(0).should.be.type 'string'
password(1).should.be.type 'string'
password(2).should.be.type 'string'
password(3).should.be.type 'string'
password(4).should.be.type 'string'
password(67).should.be.type 'string'
it 'should return an empty password when called with 0', ->
password(0).should.equal ''
it 'should return a one-word password when called with 1', ->
password(1).should.not.containEql ' '
it 'should return two words when called with 2', ->
password(2).should.match /^\S+\s\S+$/

0 comments on commit a9e9d41

Please sign in to comment.