0.8.0 • Published 2 years ago

@sociably/jest-snapshot-serializer v0.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Jest Snapshot Serializer

Format Sociably JSX elements in the jest snapshot.

Install

npm install @sociably/jest-snapshot-serializer
# or with yarn
yarn add @sociably/jest-snapshot-serializer

Setup

Add the serializer to into jest.config.js:

module.exports = {
  // ...
  snapshotSerializers: ['@sociably/jest-snapshot-serializer'],
};

Or packages.json:

{
  "name": "my-project",
  "jest": {
    "snapshotSerializers": ["@sociably/jest-snapshot-serializer"],
  }
}

Example

expect(
  <GenericTemplate imageAspectRatio="square" sharable>
    <GenericItem
      title="foo"
      imageUrl="http://foo.bar/image"
      buttons={<UrlButton title="check" url="http://xxx.yy.z" />}
    />
  </GenericTemplate>
).toMatchInlineSnapshot(`
  <GenericTemplate
    imageAspectRatio="square"
    sharable={true}
  >
    <GenericItem
      buttons={
        <UrlButton
          title="check"
          url="http://xxx.yy.z"
        />
      }
      imageUrl="http://foo.bar/image"
      title="foo"
    />
  </GenericTemplate>
`);
0.9.0-alpha.26

2 years ago

0.9.0-alpha.12

2 years ago

0.9.0-alpha.0

2 years ago

0.8.0

2 years ago

0.8.0-alpha.0

3 years ago

0.8.0-alpha.1

3 years ago

0.7.1

3 years ago

0.7.0

3 years ago