2.0.0 • Published 2 years ago

jest-serializer-json-date-id-mask v2.0.0

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

Serializer for Objects that include volatile dates and IDS

This is useful for example when testing with a DB that generates IDs and Dates

The serializer will look for columns marked as ID or Date and mask them, as these will normally change from test to test.

Please note that this will be incompatible with react projects, so if you are testing other objects use Expect.addSerializer to restrict to only one test suite.

Usage

You need to add the snapshot serializer. You have two options:

  1. Expect.addSerializer
const jsonDateIdMask = require('jest-serializer-json-date-id-mask');
expect.addSnapshotSerializer(jsonDateIdMask);
  1. Jest config

for example in package.json

{
  "name": "my project",
  "jest": {
    "snapshotSerializers": ["jest-serializer-json-date-id-mask"]
  }
}
2.0.0

2 years ago

1.6.0

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.2.0

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago