Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

expect-even-more-jest

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expect-even-more-jest

expect-more-jest with even more stuff

  • 1.17.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
977
increased by221.38%
Maintainers
1
Weekly downloads
 
Created
Source

expect-even-more-jest

Test

npm

What is it?

It's expect-more-jest with even more stuff!

Why?

Because expect-more-jest has most of the things I need, but is missing a few, which I'm not entirely sure would be accepted upstream. This way, I present one package with all the tastiness of expect-more-jest as well as all the useful things that I like!

Ok, so what's in the tin?

First, check out what expect-more-jest supplies Cool, huh?

Now, in addition to that, I've added:

describe(`expect-even-more-jest', () => {
    it(`makes your tests and output easier to read as well!`, async () => {
        // values
        expect(SomeClass).toBeConstructor();
        expect(new SomeClass()).toBeA(SomeClass);
        // syntactic sugar: better flowing
        expect(new ExcitedThing()).toBeAn(ExcitedThing);
        // test that a value is not null or undefined
        expect(someValue).toExist();
        // tests matching properties on two objects
        expect({ foo: 1, bar: 2 })
            .toIntersectionEqual({ foo: 1, quux: 2 });

        // mocks & spies
        expect(spyOrMock).toHaveBeenCalledOnce();
        expect(spyOrMock).toHaveBeenCalledOnceWith("hello", "world");

        // promises
        // - completed promises have resolved _or_ rejected
        await expect(Promise.resolve()).toBeCompleted();
        await expect(Promise.reject()).toBeCompleted();

        // test that a promise resolves within a timeframe (defaults to 50 ms)
        await expect(Promise.resolve()).toBeResolved("should have resolved", 5000);
        // test that a promise rejects within a timeframe (defaults to 50 ms)
        await expect(Promise.reject()).toBeRejected("should have rejected", 123);
        expect(new Promise(() => {})).toBePromiseLike();

        // file system
        expect(pathToFile).toBeFile();
        expect(pathToFolder).toBeFolder();

        // collections
        expect([1, 2, 3 ]).toBeEquivalentTo([ 2, 1, 3]);
        expect({ foo: 1 }).toHaveKey("foo");
        expect({ foo: 1, bar: 2 }).toHaveKeys("foo", "bar");
        expect([ 1, 2, 3 ]).toAllMatch(i => i < 4);
        // performs deep partial equality testing on elements of an array to find
        // the search object, using jasmine.objectContaining (so you don't need
        // to match _all_ properties!
        expect(arrayOfObjects).toContainElementLike(search);
    });
});

FAQs

Package last updated on 21 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc