Skip to content

[BUG] Unit tests sometimes fail depending on local system time #3906

@BlairCurrey

Description

@BlairCurrey

Some of the expected dates in limits.test.ts are timezone-naive. Depending on the system time they may fail. They fail when running here on EST, or any negative UTC offset. Meanwhile they work for positive UTC offset (so most of the Rafiki team, who are in Europe). These have always failed for me and I'm just now figuring them out.

You can verify this failing behavior by traveling to New York and then running the tests. Or by setting the timezone when running the tests:

TZ=America/New_York pnpm -F backend test packages/backend/src/open_payments/payment/outgoing/limits.test.ts

Likewise, I can set the timezone to UTC to make them pass on my machine (when they normally fail):

TZ=UTC pnpm -F backend test packages/backend/src/open_payments/payment/outgoing/limits.test.ts

The fix is simply to make the dates timezone-aware by including the Z in the date string, as all the other cases do.

Metadata

Metadata

Assignees

Labels

type: bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions