Skip to content

Commit

Permalink
Migrates tests to Mocha/Chai, minor repo cleanup
Browse files Browse the repository at this point in the history
jasmine-node is missing some useful functionality and unfortunately it appears abandoned. This commit migrates our tests to mocha/chai, but also affords us the chance to clean up tests a bit.

Also includes some minor cleanup:

- Updated version of mongoose in package.json, and marked it as a peerDep
- Added viveleroi as a contributor to package.json
- More entries in gitignore
  • Loading branch information
viveleroi committed Oct 10, 2015
1 parent b8ef070 commit ce157d8
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 244 deletions.
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
.idea/
*.sublime-workspace
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.Spotlight-V100
.Trashes
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
node_modules/
.tmp
60 changes: 35 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
{
"name": "mongoose-unique-validator",
"version": "0.4.1",
"description": "mongoose-unique-validator is a plugin which adds pre-save validation for unique fields within a Mongoose schema.",
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/jasmine-node spec/ --forceexit --captureExceptions"
},
"keywords": [
"mongoose",
"unique",
"validator"
],
"author": {
"name": "Blake Haswell",
"email": "[email protected]",
"url": "http://blakehaswell.com/"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/blakehaswell/mongoose-unique-validator.git"
},
"devDependencies": {
"jasmine-node": "1.14.x",
"mongoose": "3.8.x"
"name": "mongoose-unique-validator",
"version": "0.4.1",
"description": "mongoose-unique-validator is a plugin which adds pre-save validation for unique fields within a Mongoose schema.",
"main": "index.js",
"scripts": {
"test": "mocha test"
},
"keywords": [
"mongoose",
"unique",
"validator"
],
"author": {
"name": "Blake Haswell",
"email": "[email protected]",
"url": "http://blakehaswell.com/"
},
"contributors": [
{
"name": "Mike Botsko",
"email": "[email protected]"
}
],
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/blakehaswell/mongoose-unique-validator.git"
},
"devDependencies": {
"bluebird": "^2.10.2",
"chai": "^3.3.0",
"mocha": "^2.3.3"
},
"peerDependencies": {
"mongoose": "^4.1.10"
}
}
218 changes: 0 additions & 218 deletions spec/index.spec.js

This file was deleted.

48 changes: 48 additions & 0 deletions test/helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
var mongoose = require('mongoose');

// Helper methods/objects for tests
module.exports = {
createUserSchema: function() {
return mongoose.Schema({
username: {
type: String,
unique: true
},
email: {
type: String,
index: true,
unique: true
},
password: {
type: String
}
});
},

createCustomUserSchema: function() {
return mongoose.Schema({
username: {
type: String,
unique: 'Username is already used.'
},
email: {
type: String,
index: true,
unique: 'It already exists.'
},
password: {
type: String
}
});
},

USERS: [{
username: 'JohnSmith',
email: '[email protected]',
password: 'j0hnNYb0i'
}, {
username: 'Robert Miller',
email: '[email protected]',
password: '@b0B#b0B$b0B%'
}]
};
Loading

0 comments on commit ce157d8

Please sign in to comment.