Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
loganvolkers authored Nov 22, 2023
1 parent 1c6cc47 commit 250665e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 20 deletions.
11 changes: 4 additions & 7 deletions src/shared/getDownstreamScopes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@ import type { ScopeTuple } from "../vanilla/types";

/**
* Get a set of downstream scopes
*
*
*
*
* @param p - Parent scopes
* @param n - New scope tuple
* @returns
* @returns
*/
export function dstream(
p: ScopeTuple<unknown>[],
n: ScopeTuple<unknown>,
) {
export function dstream(p: ScopeTuple<unknown>[], n: ScopeTuple<unknown>) {
const [k] = n;
const f = p.findIndex((s) => s[0] === k);

Expand Down
16 changes: 8 additions & 8 deletions src/shared/testing/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@ export function createLifecycleUtils() {
beforeEach(() => reset());
afterEach(() => reset());

const expectUncalled = ()=>{
const expectUncalled = () => {
expect(executions).not.toHaveBeenCalled();
expect(mounts).not.toHaveBeenCalled();
expect(unmounts).not.toHaveBeenCalled();
}
};

const expectToMatchCalls = (...args:unknown[])=>{
const expectToMatchCalls = (...args: unknown[]) => {
expect(executions.mock.calls).toStrictEqual(args);
expect(mounts.mock.calls).toStrictEqual(args);
expect(unmounts.mock.calls).toStrictEqual(args);
}
};

const expectToHaveBeenCalledTimes = (num:number)=>{
const expectToHaveBeenCalledTimes = (num: number) => {
expect(executions).toHaveBeenCalledTimes(num);
expect(mounts).toHaveBeenCalledTimes(num);
expect(unmounts).toHaveBeenCalledTimes(num);
}
};

const expectActivelyMounted = ()=>{
const expectActivelyMounted = () => {
expect(executions).toHaveBeenCalledTimes(1);
expect(mounts).toHaveBeenCalledTimes(1);
expect(unmounts).toHaveBeenCalledTimes(0);
}
};

return {
expectActivelyMounted,
Expand Down
1 change: 0 additions & 1 deletion src/vue/ComponentScope.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { createLifecycleUtils } from "../shared/testing/lifecycle";
import { InjectorSymbol } from "./internal/symbols";
import { wrap } from "./testing/test-utils";


const ComponentScopedCountMolecule = molecule(() => {
use(ComponentScope);
compScopedLifecycle.connect();
Expand Down
5 changes: 1 addition & 4 deletions src/vue/useScopes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ const getTuples = (
})();

if (tuple) {
return dstream(
dstream(parentScopes, tuple),
componentScopeTuple,
);
return dstream(dstream(parentScopes, tuple), componentScopeTuple);
}
return dstream(parentScopes, componentScopeTuple);
};

0 comments on commit 250665e

Please sign in to comment.