Merge pull request #339 from smoratinos/master
refactor server test directory
This commit is contained in:
commit
84636360f4
26 changed files with 38 additions and 13 deletions
test/server
functional
article.spec.coffeeauth.spec.coffeecampaign.spec.coffeecampaign_status.spec.coffeedb-id-version.spec.coffeefile.spec.coffeelevel.spec.coffeelevel_component.spec.coffeelevel_draft.spec.coffeelevel_feedback.spec.coffeelevel_session.spec.coffeelevel_system.spec.coffeelevel_thang_component.spec.coffeelevel_thang_type.spec.coffeeuser.spec.coffee
integration/models
CampaignStatus.spec.coffeeLevel.spec.coffeeLevelComponent.spec.coffeeLevelDraft.spec.coffeeLevelSession.spec.coffeeLevelSystem.spec.coffeeLevelThangType.spec.coffeearticle.spec.coffeecampaign.spec.coffeeplugins.spec.coffee
unit
|
@ -1,4 +1,4 @@
|
||||||
require './common'
|
require '../common'
|
||||||
request = require 'request'
|
request = require 'request'
|
||||||
|
|
||||||
urlLogin = getURL('/auth/login')
|
urlLogin = getURL('/auth/login')
|
|
@ -1,4 +1,4 @@
|
||||||
require './common'
|
require '../common'
|
||||||
|
|
||||||
describe '/file', ->
|
describe '/file', ->
|
||||||
url = getURL('/file')
|
url = getURL('/file')
|
||||||
|
@ -33,7 +33,8 @@ describe '/file', ->
|
||||||
expect(body.metadata).toBeUndefined()
|
expect(body.metadata).toBeUndefined()
|
||||||
done()
|
done()
|
||||||
|
|
||||||
request.post(options, func)
|
loginJoe ->
|
||||||
|
request.post(options, func)
|
||||||
|
|
||||||
it 'can\'t be created if invalid (property path is required)', (done) ->
|
it 'can\'t be created if invalid (property path is required)', (done) ->
|
||||||
func = (err, res, body) ->
|
func = (err, res, body) ->
|
|
@ -1,4 +1,4 @@
|
||||||
require '../common'
|
require '../../common'
|
||||||
|
|
||||||
describe 'CampaignStatus', ->
|
describe 'CampaignStatus', ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require '../common'
|
require '../../common'
|
||||||
|
|
||||||
describe 'Level', ->
|
describe 'Level', ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require '../common'
|
require '../../common'
|
||||||
|
|
||||||
describe 'LevelComponent', ->
|
describe 'LevelComponent', ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require '../common'
|
require '../../common'
|
||||||
|
|
||||||
describe 'LevelDraft', ->
|
describe 'LevelDraft', ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require '../common'
|
require '../../common'
|
||||||
|
|
||||||
describe 'LevelSession', ->
|
describe 'LevelSession', ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require '../common'
|
require '../../common'
|
||||||
|
|
||||||
describe 'LevelSystem', ->
|
describe 'LevelSystem', ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require '../common'
|
require '../../common'
|
||||||
|
|
||||||
describe 'LevelThangType', ->
|
describe 'LevelThangType', ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require '../common'
|
require '../../common'
|
||||||
|
|
||||||
describe 'Article', ->
|
describe 'Article', ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require '../common'
|
require '../../common'
|
||||||
|
|
||||||
describe 'Campaign', ->
|
describe 'Campaign', ->
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
require '../common'
|
require '../../common'
|
||||||
|
|
||||||
describe 'NamePlugin', ->
|
describe 'NamePlugin', ->
|
||||||
|
|
24
test/server/unit/user.spec.coffee
Normal file
24
test/server/unit/user.spec.coffee
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
GLOBAL._ = require('lodash')
|
||||||
|
|
||||||
|
User = require '../../../server/users/User'
|
||||||
|
|
||||||
|
describe 'user', ->
|
||||||
|
|
||||||
|
it 'is Admin if it has admin permission', (done) ->
|
||||||
|
adminUser = new User()
|
||||||
|
adminUser.set('permissions', ['whatever', 'admin', 'user'])
|
||||||
|
expect(adminUser.isAdmin()).toBeTruthy()
|
||||||
|
done()
|
||||||
|
|
||||||
|
it 'isn\'t Admin if it has no permission', (done) ->
|
||||||
|
myUser = new User()
|
||||||
|
myUser.set('permissions', [])
|
||||||
|
expect(myUser.isAdmin()).toBeFalsy()
|
||||||
|
done()
|
||||||
|
|
||||||
|
it 'isn\'t Admin if it has only user permission', (done) ->
|
||||||
|
classicUser = new User()
|
||||||
|
classicUser.set('permissions', ['user'])
|
||||||
|
expect(classicUser.isAdmin()).toBeFalsy()
|
||||||
|
done()
|
||||||
|
|
Reference in a new issue