@@ -22,7 +22,7 @@ describe('Update Tests', function () {
22
22
_this . requests [ 0 ] . respond ( 200 , { 'Content-Type' : 'application/vnd.api+json' } , DSUtils . toJson ( p1 . jsonApiData ) ) ;
23
23
} , 30 ) ;
24
24
25
- return dsHttpAdapter . update ( Post , 1 , { author : 'John' , age : 30 } ) . then ( function ( data ) {
25
+ return dsHttpAdapter . update ( Post , 1 , { author : 'John' , age : 30 } , { changes : false } ) . then ( function ( data ) {
26
26
// We are not testing meta data yet
27
27
ignoreMetaData ( data ) ;
28
28
@@ -34,19 +34,19 @@ describe('Update Tests', function () {
34
34
assert . equal ( _this . requests [ 1 ] . method , 'PATCH' ) ;
35
35
assert . isDefined ( _this . requests [ 1 ] . requestHeaders ) ;
36
36
assert . include ( _this . requests [ 1 ] . requestHeaders [ 'Accept' ] , 'application/vnd.api+json' , 'Contains json api content-type header' ) ;
37
- assert . equal ( _this . requests [ 1 ] . requestBody , DSUtils . toJson ( { data : { id : "1" , type : 'posts' , attributes : { author : 'John' , age : 30 } } } ) ) ;
37
+ assert . equal ( _this . requests [ 1 ] . requestBody , DSUtils . toJson ( { data : { id : "1" , type : 'posts' , attributes : { author : 'John' , age : 30 } } } ) ) ;
38
38
39
- _this . requests [ 1 ] . respond ( 200 , { 'Content-Type' : 'application/vnd.api+json' } , DSUtils . toJson ( p1 . jsonApiData ) ) ;
39
+ _this . requests [ 1 ] . respond ( 200 , { 'Content-Type' : 'application/vnd.api+json' } , DSUtils . toJson ( p1 . jsonApiData ) ) ;
40
40
41
41
} , 30 ) ;
42
42
43
- return dsHttpAdapter . update ( Post , 1 , { author : 'John' , age : 30 } , { basePath : 'api2' } ) ;
44
- } ) . then ( function ( data ) {
45
- // We are not testing meta data yet
46
- ignoreMetaData ( data ) ;
47
-
48
- assert . deepEqual ( data , p1 . model , 'post 1 should have been updated#2 ' ) ;
49
- assert . equal ( queryTransform . callCount , 2 , 'queryTransform should have been called twice' ) ;
43
+ return dsHttpAdapter . update ( Post , 1 , { author : 'John' , age : 30 } , { basePath : 'api2' , changes : false } ) . then ( function ( data ) {
44
+ // We are not testing meta data yet
45
+ ignoreMetaData ( data ) ;
46
+
47
+ assert . deepEqual ( data , p1 . model , 'post 1 should have been updated#2' ) ;
48
+ assert . equal ( queryTransform . callCount , 2 , 'queryTransform should have been called twice ' ) ;
49
+ } ) ;
50
50
} ) ;
51
51
} ) ;
52
52
@@ -59,7 +59,9 @@ describe('Update Tests', function () {
59
59
assert . equal ( _this . requests [ 0 ] . method , 'PUT' ) ;
60
60
assert . isDefined ( _this . requests [ 0 ] . requestHeaders ) ;
61
61
assert . include ( _this . requests [ 0 ] . requestHeaders [ 'Accept' ] , 'application/vnd.api+json' , 'Contains json api content-type header' ) ;
62
- assert . equal ( _this . requests [ 0 ] . requestBody , DSUtils . toJson ( { data : { id : '1' , type : 'posts' , attributes : { author : 'John' , age : 30 } } } ) ) ;
62
+ assert . equal ( _this . requests [ 0 ] . requestBody , DSUtils . toJson (
63
+ { data : { id : '1' , type : 'posts' , attributes : { author : 'John' , age : 30 } } } )
64
+ ) ;
63
65
64
66
65
67
_this . requests [ 0 ] . respond ( 200 , { 'Content-Type' : 'application/vnd.api+json' } , DSUtils . toJson ( p1 . jsonApiData ) ) ;
@@ -77,19 +79,21 @@ describe('Update Tests', function () {
77
79
assert . equal ( _this . requests [ 1 ] . method , 'PATCH' ) ;
78
80
assert . isDefined ( _this . requests [ 1 ] . requestHeaders ) ;
79
81
assert . include ( _this . requests [ 1 ] . requestHeaders [ 'Accept' ] , 'application/vnd.api+json' , 'Contains json api content-type header' ) ;
80
- assert . equal ( _this . requests [ 1 ] . requestBody , DSUtils . toJson ( { data : { id : "1" , type : 'posts' , attributes : { author : 'John' , age : 30 } } } ) ) ;
82
+ assert . equal ( _this . requests [ 1 ] . requestBody , DSUtils . toJson (
83
+ { data : { id : "1" , type : 'posts' , attributes : { author : 'John' , age : 30 } } } )
84
+ ) ;
81
85
82
- _this . requests [ 1 ] . respond ( 200 , { 'Content-Type' : 'application/vnd.api+json' } , DSUtils . toJson ( p1 . jsonApiData ) ) ;
86
+ _this . requests [ 1 ] . respond ( 200 , { 'Content-Type' : 'application/vnd.api+json' } , DSUtils . toJson ( p1 . jsonApiData ) ) ;
83
87
84
88
} , 30 ) ;
85
89
86
- return dsHttpAdapter . update ( Post , 1 , { author : 'John' , age : 30 } , { basePath : 'api2' } ) ;
87
- } ) . then ( function ( data ) {
88
- // We are not testing meta data yet
89
- ignoreMetaData ( data ) ;
90
-
91
- assert . deepEqual ( data , p1 . model , 'post 1 should have been updated#2 ' ) ;
92
- assert . equal ( queryTransform . callCount , 2 , 'queryTransform should have been called twice' ) ;
90
+ return dsHttpAdapter . update ( Post , 1 , { author : 'John' , age : 30 } , { basePath : 'api2' , changes : false } ) . then ( function ( data ) {
91
+ // We are not testing meta data yet
92
+ ignoreMetaData ( data ) ;
93
+
94
+ assert . deepEqual ( data , p1 . model , 'post 1 should have been updated#2' ) ;
95
+ assert . equal ( queryTransform . callCount , 2 , 'queryTransform should have been called twice ' ) ;
96
+ } ) ;
93
97
} ) ;
94
98
} ) ;
95
99
@@ -131,7 +135,7 @@ describe('Update Tests', function () {
131
135
_this . requests [ 0 ] . respond ( 204 ) ; //{ 'Content-Type': 'application/vnd.api+json' }
132
136
} , 30 ) ;
133
137
134
- return dsHttpAdapter . update ( Post , 1 , { author : 'John' , age : 30 , type : 'person' } ) . then ( function ( data ) {
138
+ return dsHttpAdapter . update ( Post , 1 , { author : 'John' , age : 30 , type : 'person' } , { changes : false } ) . then ( function ( data ) {
135
139
// We are not testing meta data yet
136
140
ignoreMetaData ( data ) ;
137
141
@@ -275,7 +279,7 @@ describe('Update Tests', function () {
275
279
var author = testData . config . Author . get ( 1 ) ;
276
280
assert . isDefined ( author , 'Author should be in DS' ) ;
277
281
author . name = 'New Author' ;
278
- return ds . save ( 'author' , author . id , { jsonApi : { updateRelationships : true } } ) . then ( function ( data ) {
282
+ return ds . save ( 'author' , author . id , { changes : false , jsonApi : { updateRelationships : true } } ) . then ( function ( data ) {
279
283
assert . isDefined ( data , 'Result Should exists' ) ;
280
284
assert . equal ( data . name , 'New Author' ) ;
281
285
0 commit comments