Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@centrapay/jest-date-matchers

centrapay186Apache-2.01.1.3

Centrapay Jest date matchers

jest, expect, assert, matchers, date, iso8601, threshold

readme

Jest Date Matchers

Centrapay Jest date matchers.

Matches date strings within a configurable threshold range.

Installation

npm install @centrapay/jest-date-matchers

Usage

// Add to jest.config.js:
module.exports = {
  setupFilesAfterEnv: [ '@centrapay/jest-date-matchers' ],
};

// or add to a cucumber support file:
require('@centrapay/jest-date-matchers');

// then use assertion in test or step definition:
const payload = { createdAt: '2020-09-01T10:45:00.250Z' };
expect(payload.createdAt).toBeIsoDateStringNear('2020-09-01T10:45:00.000Z'); // default match within 1 second
expect(payload.createdAt).toBeIsoDateStringNear(moment(), { threshold: 10, units: 'seconds' });

History

See Changelog

Copyright © 2020 Centrapay.

This software is licensed under Apache-2.0 License. Please see LICENSE for details.

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

1.1.3 - 2024-10-28

Changed

  • refresh lockfile to remove references to @babel/traverse<7.23.2

1.1.2 - 2024-10-16

Changed

  • upgrade jest dependency

1.1.1 - 2024-01-29

Changed

  • import expect as a named module

1.1.0 - 2022-02-02

Added

  • toBeIsoDateString assertion

    Changed

  • remove moment as runtime dependency

1.0.2 - 2020-09-21

Changed

  • relax dependency version constraints

1.0.1 - 2020-09-21

Changed

  • fix typo in readme usage instructions

1.0.0 - 2020-09-20

Added

  • toBeIsoDateStringNear assertion