Skip to content

Commit

Permalink
chore: make tests more splittable
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Jan 16, 2025
1 parent 1110717 commit 7b535ec
Showing 1 changed file with 24 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,34 +395,33 @@ function getMutations(): Mutation[] {
];
}

module('Integration | Relationships | Collection | Mutation', function (hooks) {
setupRenderingTest(hooks);

hooks.beforeEach(function () {
this.owner.register('model:user', User);
});
getStartingState().forEach((startingState) => {
getMutations().forEach((mutation) => {
module(
`Integration | Relationships | Collection | Mutation > Starting state: ${startingState.name} > Mutation: ${mutation.name}`,
function (hooks) {
setupRenderingTest(hooks);

hooks.beforeEach(function () {
this.owner.register('model:user', User);
});

getStartingState().forEach((startingState) => {
module(`Starting state: ${startingState.name}`, function () {
getMutations().forEach((mutation) => {
module(`Mutation: ${mutation.name}`, function () {
getMutations().forEach((mutation2) => {
test(`followed by Mutation: ${mutation2.name}`, async function (assert) {
const store = this.owner.lookup('service:store') as Store;
const user = startingState.cb(store);
const rc = await reactiveContext.call(this, user, {
identity: null,
type: 'user',
fields: [{ name: 'friends', kind: 'hasMany', type: 'user', options: { async: false, inverse: null } }],
});
rc.reset();

await applyMutation(assert, store, user, mutation, rc);
await applyMutation(assert, store, user, mutation2, rc);
getMutations().forEach((mutation2) => {
test(`followed by Mutation: ${mutation2.name}`, async function (assert) {
const store = this.owner.lookup('service:store') as Store;
const user = startingState.cb(store);
const rc = await reactiveContext.call(this, user, {
identity: null,
type: 'user',
fields: [{ name: 'friends', kind: 'hasMany', type: 'user', options: { async: false, inverse: null } }],
});
rc.reset();

await applyMutation(assert, store, user, mutation, rc);
await applyMutation(assert, store, user, mutation2, rc);
});
});
});
});
}
);
});
});

0 comments on commit 7b535ec

Please sign in to comment.