Comparing version 1.3.0 to 1.3.1
{ | ||
"name": "lw-sdk", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "SDK for Laurel & Wolf API", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -32,2 +32,7 @@ import {map, forEach, pick} from 'lodash'; | ||
// Don't overwrite key that already exists | ||
if (root[resource.type] && root[resource.type][resource.id]) { | ||
return root; | ||
} | ||
Object.defineProperty(root[resource.type], resource.id, { | ||
@@ -34,0 +39,0 @@ enumerable: true, |
@@ -8,2 +8,3 @@ import serialize from '../src/serialize'; | ||
import responseDataNoRelationships from './mock/jsonapi-response-no-rel'; | ||
import repsonseDuplicateKey from './mock/jsonapi-response-duplicate-key'; | ||
import {namespace} from './utils/testing'; | ||
@@ -90,2 +91,14 @@ | ||
test.response('does not overwrite key if it already exists', ({pass, fail}) => { | ||
try { | ||
let res = serialize.response(repsonseDuplicateKey); | ||
res.data.relationships.documents; | ||
pass('ignored duplicate keys'); | ||
} | ||
catch (e) { | ||
fail(e.message); | ||
} | ||
}); | ||
test.response('should assign relationships to a key by relationship name, not type name', ({notEqual}) => { | ||
@@ -92,0 +105,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
256820
36
6719