-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17c7689
commit ad7c06d
Showing
9 changed files
with
178 additions
and
112 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
|
||
|
||
describe('cms-auth', function(){ | ||
it('should have /auth/login route', function (done) { | ||
// | ||
done(); | ||
/* global define */ | ||
define([ | ||
'intern!object', | ||
'intern/chai!assert', | ||
'intern/dojo/node!request' | ||
], function (registerSuite, assert, request) { | ||
'use strict'; | ||
registerSuite({ | ||
name: 'cms-auth', | ||
'should have /auth/login route': function () { | ||
this.skip(); | ||
}, | ||
'should have /auth/register route': function () { | ||
this.skip(); | ||
}, | ||
'should have /auth/me route': function () { | ||
this.skip(); | ||
} | ||
}); | ||
it('should have /auth/register route', function (done) { | ||
// | ||
done(); | ||
}); | ||
it('should have /auth/me route', function (done) { | ||
// | ||
done(); | ||
}); | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,62 @@ | ||
"use strict"; | ||
var request = require('supertest'); | ||
var path = require('path'); | ||
var fs = require('fs'); | ||
var expect = require('chai').expect; | ||
var express = require('express'); | ||
var app = express(); | ||
var config = JSON.parse(fs.readFileSync(process.cwd() + '/config/config.json')); | ||
config.port = 9191 | ||
|
||
var cmsPassport = require(process.cwd() + '/routes/cms-passport')(config, app); | ||
describe('cms-passport', function () { | ||
|
||
it('should have /account route', function (done) { | ||
done(); | ||
}); | ||
it('should have /auth/login route', function (done) { | ||
// | ||
}); | ||
|
||
it('POST - /login - should return user on successful login', function (done) { | ||
/* global define */ | ||
define([ | ||
'intern!object', | ||
'intern/chai!expect', | ||
'intern/dojo/node!path', | ||
'intern/dojo/node!fs', | ||
'intern/dojo/node!supertest', | ||
'intern/dojo/node!express', | ||
'intern/dojo/node!../../routes/cms-passport', | ||
], function (registerSuite, expect, path, fs, request, express, cmsPassport) { | ||
'use strict'; | ||
|
||
|
||
var app = express(); | ||
var config = JSON.parse(fs.readFileSync(process.cwd() + '/config/config.json')); | ||
config.port = 9191 | ||
|
||
cmsPassport(config, app); | ||
|
||
|
||
registerSuite({ | ||
name: 'cms-passport', | ||
'should have /proxy route': function () { | ||
}, | ||
'should have a /auth/google/callback route': function () { | ||
}, | ||
'should have a /auth/google route': function () { | ||
}, | ||
'should have /auth/me route': function () { | ||
}, | ||
'should have /auth/register route': function () { | ||
}, | ||
'POST - /register - should return user on successful registration': function () { | ||
var dfd = this.async(); | ||
request(app) | ||
.post('/register') | ||
.send({ | ||
"username": Date.now() + "[email protected]", | ||
"email": Date.now() + "[email protected]", | ||
"password": "test", | ||
"metadata": { | ||
"avatar": "", | ||
"name": "Jonnie Dollas" | ||
} | ||
}) | ||
.expect("Content-Type", /json/) | ||
.expect(201, dfd.resolve); | ||
}, | ||
'POST - /login - should return user on successful login': function () { | ||
var dfd = this.async(); | ||
var validUser = { | ||
username: '[email protected]', | ||
password: 'test' | ||
}; | ||
request(app) | ||
.post('/login') | ||
.send(validUser) | ||
.expect("Content-Type", /json/) | ||
.expect(200, done); | ||
}); | ||
|
||
|
||
it('POST - /register - should return user on successful registation', function (done) { | ||
request(app) | ||
.post('/register') | ||
.send({ | ||
"username": Date.now() + "[email protected]", | ||
"email": Date.now() + "[email protected]", | ||
"password": "test", | ||
"metadata": { | ||
"avatar": "", | ||
"name": "Jonnie Dollas" | ||
} | ||
}) | ||
.expect("Content-Type", /json/) | ||
.expect(201, done); | ||
.post('/login') | ||
.send(validUser) | ||
.expect("Content-Type", /json/) | ||
.expect(200, dfd.resolve); | ||
} | ||
}); | ||
|
||
|
||
|
||
it('should have /auth/register route', function (done) { | ||
// | ||
done(); | ||
}); | ||
|
||
it('should have /auth/me route', function (done) { | ||
// | ||
done(); | ||
}); | ||
|
||
describe('Google Auth', function () { | ||
it('should have a /auth/google route', function (done) { | ||
// | ||
done(); | ||
}); | ||
it('should have a /auth/google/callback route', function (done) { | ||
// | ||
done(); | ||
}); | ||
}); | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* global define */ | ||
define([ | ||
'intern!object', | ||
'intern/chai!assert', | ||
'intern/dojo/node!request' | ||
], function (registerSuite, assert, request) { | ||
'use strict'; | ||
registerSuite({ | ||
name: 'cms-proxy', | ||
'should have /proxy route': function () { | ||
this.skip(); | ||
} | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
describe('cms-rest', function () { | ||
it('should have a /collection/:id route', function (done) { | ||
// | ||
done(); | ||
/* global define */ | ||
define([ | ||
'intern!object', | ||
'intern/chai!assert', | ||
'intern/dojo/node!request' | ||
], function (registerSuite, assert, request) { | ||
'use strict'; | ||
registerSuite({ | ||
name: 'cms-rest', | ||
'GET - /collection - should return array of items': function () { | ||
this.skip(); | ||
}, | ||
'GET - /collection/:id - should return object item': function () { | ||
this.skip(); | ||
}, | ||
'POST - /collection - should return object on success': function () { | ||
this.skip(); | ||
}, | ||
'PUT - /collection/:id - should return object on success': function () { | ||
this.skip(); | ||
} | ||
}); | ||
it('GET - /collection - should return array of items', function (done) { | ||
done(); | ||
}); | ||
it('GET - /collection/:id - should return object item', function (done) { | ||
// | ||
done(); | ||
}); | ||
it('POST - /collection - should return object on success', function (done) { | ||
// | ||
done(); | ||
}); | ||
it('PUT - /collection/:id - should return object on success', function (done) { | ||
done(); | ||
}); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* global define */ | ||
define([ | ||
'intern!object', | ||
'intern/chai!assert', | ||
'intern/dojo/node!request' | ||
], function (registerSuite, assert, request) { | ||
'use strict'; | ||
registerSuite({ | ||
name: 'cms-server', | ||
'should have /proxy route': function () { | ||
this.skip(); | ||
} | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* global define */ | ||
define([ | ||
'intern!object', | ||
'intern/chai!assert', | ||
'intern/dojo/node!request' | ||
], function (registerSuite, assert, request) { | ||
'use strict'; | ||
registerSuite({ | ||
name: 'cms-sockets', | ||
'should have /proxy route': function () { | ||
this.skip(); | ||
} | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* global define */ | ||
define([ | ||
'intern!object', | ||
'intern/chai!assert', | ||
'intern/dojo/node!request' | ||
], function (registerSuite, assert, request) { | ||
'use strict'; | ||
registerSuite({ | ||
name: 'cms-upload', | ||
'should have /proxy route': function () { | ||
this.skip(); | ||
} | ||
}); | ||
}); |