@@ -98,10 +98,13 @@ describe("Creating Resources", () => {
98
98
. type ( "application/vnd.api+json" )
99
99
. send ( { "data" : ORG_RESOURCE_CLIENT_ID } )
100
100
. promise ( )
101
- . then ( ( ) => done ( "Should not run!" ) , ( error ) => {
102
- err = error ;
103
- done ( ) ;
104
- } ) ;
101
+ . then (
102
+ ( ) => { done ( "Should not run!" ) } ,
103
+ ( error ) => {
104
+ err = error ;
105
+ done ( ) ;
106
+ }
107
+ ) ;
105
108
} ) ;
106
109
107
110
describe ( "HTTP" , ( ) => {
@@ -116,40 +119,45 @@ describe("Creating Resources", () => {
116
119
} ) ;
117
120
} ) ;
118
121
} ) ;
119
- } ) ;
120
122
121
- describe ( "" , ( ) => {
122
- AgentPromise . then ( ( Agent ) => {
123
- Agent . request ( "POST" , "/organizations" )
124
- . type ( "application/vnd.api+json" )
125
- . send ( { "data" : INVALID_ORG_RESOURCE_NO_DATA_IN_RELATIONSHIP } )
126
- . promise ( )
127
- . then ( ( ) => { throw new Error ( "Should not run!" ) ; } , ( err ) => {
128
- describe ( "Creating a Resource With a Missing Relationship Data Key" , ( ) => {
129
- describe ( "HTTP" , ( ) => {
130
- it ( "should return 400" , ( ) => {
131
- expect ( err . response . status ) . to . equal ( 400 ) ;
132
- } ) ;
133
- } ) ;
123
+ describe ( "Creating a Resource With a Missing Relationship Data Key" , ( ) => {
124
+ let err ;
125
+ before ( ( done ) => {
126
+ Agent . request ( "POST" , "/organizations" )
127
+ . type ( "application/vnd.api+json" )
128
+ . send ( { "data" : INVALID_ORG_RESOURCE_NO_DATA_IN_RELATIONSHIP } )
129
+ . promise ( )
130
+ . then (
131
+ ( ) => { done ( "Should not run!" ) ; } ,
132
+ ( error ) => {
133
+ err = error ;
134
+ done ( ) ;
135
+ }
136
+ ) ;
137
+ } ) ;
134
138
135
- describe ( "Document Structure " , ( ) => {
136
- it ( "should contain an error " , ( ) => {
137
- expect ( err . response . body . errors ) . to . be . an ( "array" ) ;
138
- } ) ;
139
- } ) ;
139
+ describe ( "HTTP " , ( ) => {
140
+ it ( "should return 400 " , ( ) => {
141
+ expect ( err . response . status ) . to . equal ( 400 ) ;
142
+ } ) ;
143
+ } ) ;
140
144
141
- describe ( "Error" , ( ) => {
142
- it ( "should have the correct title" , ( ) => {
143
- expect ( err . response . body . errors [ 0 ] . title ) . to . be . equal ( "Missing relationship linkage." ) ;
144
- } ) ;
145
+ describe ( "Document Structure" , ( ) => {
146
+ it ( "should contain an error" , ( ) => {
147
+ expect ( err . response . body . errors ) . to . be . an ( "array" ) ;
148
+ } ) ;
149
+ } ) ;
145
150
146
- it ( "should have the correct details" , ( ) => {
147
- expect ( err . response . body . errors [ 0 ] . details ) . to . be . equal ( "No data was found for the liaisons relationship." ) ;
148
- } ) ;
149
- } ) ;
150
- } ) ;
151
- } ) . done ( ) ;
152
- } ) . done ( ) ;
151
+ describe ( "The error" , ( ) => {
152
+ it ( "should have the correct title" , ( ) => {
153
+ expect ( err . response . body . errors [ 0 ] . title ) . to . be . equal ( "Missing relationship linkage." ) ;
154
+ } ) ;
155
+
156
+ it ( "should have the correct details" , ( ) => {
157
+ expect ( err . response . body . errors [ 0 ] . details ) . to . be . equal ( "No data was found for the liaisons relationship." ) ;
158
+ } ) ;
159
+ } ) ;
160
+ } ) ;
153
161
} ) ;
154
162
155
163
// "[S]erver implementations MUST ignore
0 commit comments