Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Sep 3, 2023
1 parent 3a434d6 commit 50a6fb1
Show file tree
Hide file tree
Showing 6 changed files with 649 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@
**/dist-control/
**/dist-experiment/
**/tmp/
/packages/-ember-data/docs/
/packages/tracking/addon/
/packages/request/addon/
/packages/store/addon/
/packages/adapter/addon/
/packages/-ember-data/docs/
/packages/tracking/addon/
/packages/serializer/addon/
/packages/model/addon/
/packages/json-api/addon/
/packages/graph/addon/
/packages/legacy-compat/addon/
/packages/request-utils/addon/
/packages/rest/addon/
/packages/active-record/addon/

**/DEBUG/

Expand Down
6 changes: 5 additions & 1 deletion @types/ember-data-qunit-asserts/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ declare global {
expectNoWarning(callback: () => unknown): Promise<void>;
expectAssertion(callback: () => unknown, matcher: string | RegExp): Promise<void>;
expectNoAssertion(callback: () => unknown): Promise<void>;
/**
* Asserts that each member of actual strictly matches the corresponding member of expected.
* Asserts that actual is an array and has the same length as expected.
*/
arrayStrictEquals<T>(actual: unknown, expected: T[], message: string): void;
}

Expand All @@ -34,7 +38,7 @@ declare global {
expectNoWarning(callback: () => unknown): Promise<void>;
expectAssertion(callback: () => unknown, matcher: string | RegExp): Promise<void>;
expectNoAssertion(callback: () => unknown): Promise<void>;
arrayStrictEquals<T>(actual: T[], expected: T[], message: string): void;
arrayStrictEquals<T>(unknown, expected: T[], message: string): void;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/json-api/src/-private/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export default class JSONAPICache implements Cache {
let i: number, length: number;
const { identifierCache } = this.__storeWrapper;

if (true) {
if (LOG_REQUESTS) {
const Counts = new Map();
if (included) {
for (i = 0, length = included.length; i < length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ export function configureBetterAsserts() {
HAS_REGISTERED = true;

QUnit.assert.arrayStrictEquals = function <T>(actual: T[], expected: T[], message: string): void {
if (!Array.isArray(actual)) {
this.pushResult({
result: false,
actual: false,
expected: true,
message: 'Expected the value for "actual" to be an array | ' + message,
});
return;
}
if (!Array.isArray(expected)) {
this.pushResult({
result: false,
actual: false,
expected: true,
message: 'Expected the value for "expected"" to be an array',
});
return;
}
let passed = actual.length === expected.length;

let actualRefs = new Map<T, string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
import type Store from '@ember-data/store';
import { deprecatedTest } from '@ember-data/unpublished-test-infra/test-support/deprecated-test';

module('Integration | Graph | Remote State Does Not Reset Local State', function (hooks: NestedHooks) {
module('Integration | Graph | Diff Preservation', function (hooks: NestedHooks) {
setupTest(hooks);

deprecatedTest(
Expand Down
Loading

0 comments on commit 50a6fb1

Please sign in to comment.