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

jest-serializer-react-helmet-async

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-serializer-react-helmet-async

Serializer to display react-helmet-async data in Jest Snapshots

  • 1.0.21
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.8K
decreased by-13.23%
Maintainers
1
Weekly downloads
 
Created
Source

jest-serializer-react-helmet-async

Jest Snapshot serializer to visualize react-helmet-async data alongside component snapshots.

Installation

Install preset using npm:

npm install --save-dev jest-serializer-react-helmet-async

or yarn:

yarn add --dev jest-serializer-react-helmet-async

Usage

Configure Jest to use the serializer in jest.config.js:

module.exports = {
  snapshotSerializers: ["jest-serializer-react-helmet-async"],
};

or package.json:

{
  "jest": {
    "snapshotSerializers": ["jest-serializer-react-helmet-async"]
  }
}

In your tests

Unlike jest-serializer-react-helmet, this serializer does not automatically prepend the serialized data to the snapshots of your React components. You must add an assert for react-helmet-async to be serialized.

Your test should like similar to the following:

import * as React from "react";
import renderer from "react-test-renderer";
import { HelmetProvider } from "react-helmet-async";

describe("App", () => {
  it("renders as expected", () => {
    const context = {};
    const tree = renderer
      .create(
        <HelmetProvider context={context}>
          <App />
        </HelmetProvider>
      )
      .toJSON();

    expect(tree).toMatchSnapshot();
    expect(context.helmet).toMatchSnapshot();
  });
});

License

Copyright 2019 Kepler Sticka-Jones. Licensed ISC

Keywords

FAQs

Package last updated on 03 Aug 2021

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