Skip to content

Commit 73dde90

Browse files
committed
cleanup asserts
1 parent 4a078b6 commit 73dde90

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

packages/active-record/src/-private/builders/save-record.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ export function deleteRecord(record: unknown, options: ConstrainedRequestOptions
139139
export function createRecord(record: unknown, options: ConstrainedRequestOptions = {}): CreateRequestOptions {
140140
const identifier = recordIdentifierFor(record);
141141
assert(`Expected to be given a record instance`, identifier);
142-
// assert(`Cannot delete a record that does not have an associated type and id.`, isExisting(identifier));
143142

144143
const urlOptions: CreateRecordUrlOptions = {
145144
identifier: identifier,
@@ -215,7 +214,7 @@ export function updateRecord(
215214
): UpdateRequestOptions {
216215
const identifier = recordIdentifierFor(record);
217216
assert(`Expected to be given a record instance`, identifier);
218-
assert(`Cannot delete a record that does not have an associated type and id.`, isExisting(identifier));
217+
assert(`Cannot update a record that does not have an associated type and id.`, isExisting(identifier));
219218

220219
const urlOptions: UpdateRecordUrlOptions = {
221220
identifier: identifier,

packages/json-api/src/-private/builders/save-record.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ export function deleteRecord(record: unknown, options: ConstrainedRequestOptions
139139
export function createRecord(record: unknown, options: ConstrainedRequestOptions = {}): CreateRequestOptions {
140140
const identifier = recordIdentifierFor(record);
141141
assert(`Expected to be given a record instance`, identifier);
142-
// TODO: seems to be wrong assert here, at least message is confusing
143-
// assert(`Cannot delete a record that does not have an associated type and id.`, isExisting(identifier));
144142

145143
const urlOptions: CreateRecordUrlOptions = {
146144
identifier: identifier,
@@ -217,7 +215,7 @@ export function updateRecord(
217215
): UpdateRequestOptions {
218216
const identifier = recordIdentifierFor(record);
219217
assert(`Expected to be given a record instance`, identifier);
220-
assert(`Cannot delete a record that does not have an associated type and id.`, isExisting(identifier));
218+
assert(`Cannot update a record that does not have an associated type and id.`, isExisting(identifier));
221219

222220
const urlOptions: UpdateRecordUrlOptions = {
223221
identifier: identifier,

packages/rest/src/-private/builders/save-record.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ export function deleteRecord(record: unknown, options: ConstrainedRequestOptions
139139
export function createRecord(record: unknown, options: ConstrainedRequestOptions = {}): CreateRequestOptions {
140140
const identifier = recordIdentifierFor(record);
141141
assert(`Expected to be given a record instance`, identifier);
142-
// assert(`Cannot delete a record that does not have an associated type and id.`, isExisting(identifier));
143142

144143
const urlOptions: CreateRecordUrlOptions = {
145144
identifier: identifier,
@@ -215,7 +214,7 @@ export function updateRecord(
215214
): UpdateRequestOptions {
216215
const identifier = recordIdentifierFor(record);
217216
assert(`Expected to be given a record instance`, identifier);
218-
assert(`Cannot delete a record that does not have an associated type and id.`, isExisting(identifier));
217+
assert(`Cannot update a record that does not have an associated type and id.`, isExisting(identifier));
219218

220219
const urlOptions: UpdateRecordUrlOptions = {
221220
identifier: identifier,

0 commit comments

Comments
 (0)