Skip to content

Commit

Permalink
chore: improve anyone code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Aug 8, 2022
1 parent b286f4b commit 3f18579
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
10 changes: 10 additions & 0 deletions packages/anyone/src/__tests__/runAnyoneMethods.test.ts
Expand Up @@ -28,4 +28,14 @@ describe('lib/run', () => {
);
});
});

describe('When the function throws an error', () => {
it('Should return false', () => {
expect(
run(() => {
throw new Error();
})
).toBe(false);
});
});
});
2 changes: 1 addition & 1 deletion packages/anyone/src/runner/runAnyoneMethods.ts
Expand Up @@ -17,5 +17,5 @@ export default function run(arg: unknown): boolean {

function check(value: unknown): boolean {
// We use abstract equality intentionally here. This enables falsy valueOf support.
return Array.isArray(value) ? true : value != false && Boolean(value); // eslint-disable-line
return Array.isArray(value) ? true : value != false && Boolean(value);
}
2 changes: 1 addition & 1 deletion packages/n4s/src/runtime/enforceContext.ts
Expand Up @@ -22,7 +22,7 @@ export const ctx = createCascade<CTXType>((ctxRef, parentContext): CTXType => {

function stripContext(ctx: null | CTXType): EnforceContext {
if (!ctx) {
return ctx;
return null;
}

return {
Expand Down
9 changes: 2 additions & 7 deletions packages/vest/src/core/test/runAsyncTest.ts
Expand Up @@ -32,11 +32,6 @@ export default function runAsyncTest(testObject: VestTest): void {

done();
});
try {
asyncTest.then(done, fail);
} catch (e) {
// We will probably never get here, unless the consumer uses a buggy custom Promise
// implementation that behaves differently than the native one, or if they for some
fail();
}

asyncTest.then(done, fail);
}

1 comment on commit 3f18579

@vercel
Copy link

@vercel vercel bot commented on 3f18579 Aug 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vest-next – ./website

vest-next-ealush.vercel.app
vest-next-git-latest-ealush.vercel.app
vest-next.vercel.app
vest-website.vercel.app

Please sign in to comment.