Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ember specific data utils #9260

Merged
merged 26 commits into from
Mar 22, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
lint fixes
  • Loading branch information
runspired committed Mar 21, 2024
commit 8bd268fffdb3349b9342383fd37390b9a924310e
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
import { recordIdentifierFor } from '@ember-data/store';
import type { StableRecordIdentifier } from '@warp-drive/core-types';
import type { CollectionResourceDocument } from '@warp-drive/core-types/spec/raw';
import type { Diagnostic } from '@warp-drive/diagnostic';
import type { Diagnostic } from '@warp-drive/diagnostic/-types';

import type { Context, UserRecord } from './setup';
import { stateOf } from './setup';
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { TestContext } from '@ember/test-helpers';

import { graphFor } from '@ember-data/graph/-private';
import type { CollectionEdge } from '@ember-data/graph/-private/edges/collection';
import type { ImplicitEdge } from '@ember-data/graph/-private/edges/implicit';
@@ -11,7 +9,8 @@ import type { ModelSchema } from '@ember-data/store/-types/q/ds-model';
import type { StableRecordIdentifier } from '@warp-drive/core-types';
import type { CollectionRelationship } from '@warp-drive/core-types/cache/relationship';
import type { ResourceType } from '@warp-drive/core-types/symbols';
import type { EmberHooks } from '@warp-drive/diagnostic';
import type { Hooks } from '@warp-drive/diagnostic/-types';
import type { RenderingTestContext } from '@warp-drive/diagnostic/ember';
import { setupTest } from '@warp-drive/diagnostic/ember';

class AbstractMap {
@@ -49,7 +48,7 @@ class AbstractGraph {
const implicits = Object.create(null) as Record<string, ImplicitEdge>;
if (rels) {
Object.keys(rels).forEach((key) => {
const rel = rels[key]!;
const rel = rels[key];
if (rel && isImplicit(rel)) {
implicits[key] = rel;
}
@@ -135,12 +134,12 @@ export type UserRecord = Model & {
[ResourceType]: 'user';
};

export interface Context extends TestContext {
export interface Context extends RenderingTestContext {
store: Store;
graph: AbstractGraph;
}

export function setupGraphTest(hooks: EmberHooks<Context>) {
export function setupGraphTest(hooks: Hooks<Context>) {
setupTest(hooks);
hooks.beforeEach(function (this: Context) {
this.owner.register('adapter:application', Adapter);
Loading