- fix(ParseRelation): Schema mismatch on empty array
Closes: https://github.com/parse-community/Parse-SDK-JS/issues/1217
- Improve coverage
85 | 85 | if (!parent) { |
|
86 | 86 | throw new Error('Cannot add to a Relation without a parent'); |
|
87 | 87 | } |
|
88 | + | if (objects.length === 0) { |
|
89 | + | return parent; |
|
90 | + | } |
|
88 | 91 | parent.set(this.key, change); |
|
89 | 92 | this.targetClassName = change._targetClassName; |
|
90 | 93 | return parent; |
104 | 107 | if (!this.parent) { |
|
105 | 108 | throw new Error('Cannot remove from a Relation without a parent'); |
|
106 | 109 | } |
|
110 | + | if (objects.length === 0) { |
|
111 | + | return; |
|
112 | + | } |
|
107 | 113 | this.parent.set(this.key, change); |
|
108 | 114 | this.targetClassName = change._targetClassName; |
|
109 | 115 | } |
Files | Coverage |
---|---|
src | 92.38% |
Project Totals (54 files) | 92.38% |