user.test.js 997 B

12345678910111213141516171819202122232425262728293031323334
  1. var chai = require('chai')
  2. , expect = chai.expect
  3. , sinon = require('sinon')
  4. , sinonChai = require('sinon-chai')
  5. , Promise = require('bluebird')
  6. , utils = require('../utils.js')
  7. ;
  8. chai.use(sinonChai);
  9. describe('User', function () {
  10. var Page = utils.models.Page,
  11. User = utils.models.User,
  12. conn = utils.mongoose.connection;
  13. describe('Create and Find.', function () {
  14. context('The user', function() {
  15. it('should created', function(done) {
  16. User.createUserByEmailAndPassword('Aoi Miyazaki', 'aoi', 'aoi@example.com', 'hogefuga11', function (err, userData) {
  17. expect(err).to.be.null;
  18. expect(userData).to.instanceof(User);
  19. done();
  20. });
  21. });
  22. it('should be found by findUserByUsername', function(done) {
  23. User.findUserByUsername('aoi', function (err, userData) {
  24. expect(err).to.be.null;
  25. expect(userData).to.instanceof(User);
  26. done();
  27. });
  28. });
  29. });
  30. });
  31. });