Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NullVoxPopuli committed Mar 16, 2023
1 parent dccab58 commit 389ec18
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .changeset/hip-actors-hide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
"ember-resources": patch
---

when using RemoteData, isError should be true when the http status code is >= 400. Resolves #825"
When using RemoteData, isError should be true when the http status code is >= 400. Resolves #825".
Previously, when you had a JSON response with 404 status code, `isError` would be false instead of true.
8 changes: 4 additions & 4 deletions test-app/tests/utils/remote-data/js-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ module('Utils | remote-data | js', function (hooks) {
errors: [{ detail: 'Blog not found', status: '404' }],
});
assert.false(test.request.isLoading);
assert.false(test.request.isError);
assert.true(test.request.isError, 'isError');
assert.true(test.request.isResolved);
assert.strictEqual(test.request.status, 404);
assert.strictEqual(test.request.status, 404, 'expected status');
});

module('works with non-json requests', function () {
Expand Down Expand Up @@ -203,7 +203,7 @@ module('Utils | remote-data | js', function (hooks) {

assert.strictEqual(test.request.value, 'hello world');

assert.strictEqual(test.request.status, 200);
assert.strictEqual(test.request.status, 500);
});
});
});
Expand Down Expand Up @@ -346,7 +346,7 @@ module('Utils | remote-data | js', function (hooks) {
errors: [{ detail: 'Blog not found', status: '404' }],
});
assert.false(test.request.isLoading);
assert.false(test.request.isError);
assert.true(test.request.isError);
assert.true(test.request.isResolved);
assert.strictEqual(test.request.status, 404);
});
Expand Down

0 comments on commit 389ec18

Please sign in to comment.