2
2
3
3
var expect = require ( 'chai' ) . expect ;
4
4
var uuid = require ( 'node-uuid' ) ;
5
+ var utils = require ( '../utils' )
5
6
6
7
module . exports = function ( server ) {
7
8
@@ -14,33 +15,30 @@ module.exports = function (server) {
14
15
15
16
it ( 'can get a domain by id' , function ( ) {
16
17
return server . injectThen ( '/domains/' + domain . id )
18
+ . tap ( utils . assertStatus ( 200 ) )
17
19
. then ( function ( response ) {
18
- expect ( response . statusCode ) . to . equal ( 200 ) ;
19
20
expect ( JSON . parse ( response . payload ) ) . to . have . property ( 'name' , 'ourgala.org' ) ;
20
21
} ) ;
21
22
} ) ;
22
23
23
24
it ( 'can get a domain by name' , function ( ) {
24
25
return server . injectThen ( '/domains/ourgala.org' )
26
+ . tap ( utils . assertStatus ( 200 ) )
25
27
. then ( function ( response ) {
26
- expect ( response . statusCode ) . to . equal ( 200 ) ;
27
28
expect ( JSON . parse ( response . payload ) ) . to . have . property ( 'id' , domain . id ) ;
28
29
} ) ;
29
30
} ) ;
30
31
31
32
it ( 'can get the related campaign' , function ( ) {
32
33
return server . injectThen ( '/domains/ourgala.org?expand[]=campaign' )
34
+ . tap ( utils . assertStatus ( 200 ) )
33
35
. then ( function ( response ) {
34
- expect ( response . statusCode ) . to . equal ( 200 ) ;
35
36
expect ( JSON . parse ( response . payload ) ) . to . have . deep . property ( 'campaign.id' ) . with . length ( 36 ) ;
36
37
} ) ;
37
38
} ) ;
38
39
39
40
it ( 'responds with 404 if the domain is not found' , function ( ) {
40
- return server . injectThen ( '/domains/theirgala.org' )
41
- . then ( function ( response ) {
42
- expect ( response . statusCode ) . to . equal ( 404 ) ;
43
- } ) ;
41
+ return server . injectThen ( '/domains/theirgala.org' ) . then ( utils . assertStatus ( 404 ) ) ;
44
42
} ) ;
45
43
46
44
} ) ;
0 commit comments