Skip to content

Commit

Permalink
chore: cleanup comments, join on fees again, fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
BlairCurrey committed Feb 26, 2025
1 parent 3164ed9 commit 0ee9794
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 378 deletions.
10 changes: 6 additions & 4 deletions packages/backend/src/open_payments/quote/service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ describe('QuoteService', (): void => {
test.each`
expiryDate | description
${new Date(new Date().getTime() + Config.quoteLifespan - 2 * 60_000)} | ${"the incoming payment's expirataion date"}
${new Date(new Date().getTime() + Config.quoteLifespan + 2 * 60_000)} | ${"the quotation's creation date plus its lifespan"}
${new Date(new Date().getTime() + Config.quoteLifespan + 2 * 60_000)} | ${"the quote's creation date plus its lifespan"}
`(
'sets expiry date to $description',
async ({ expiryDate }): Promise<void> => {
Expand Down Expand Up @@ -406,11 +406,13 @@ describe('QuoteService', (): void => {
.spyOn(paymentMethodHandlerService, 'getQuote')
.mockResolvedValueOnce(mockedQuote)

jest.useFakeTimers()
const now = Date.now()
jest.spyOn(global.Date, 'now').mockImplementation(() => now)

const quote = await quoteService.create(options)
assert.ok(!isQuoteError(quote))
const maxExpiration = new Date(
quote.createdAt.getTime() + config.quoteLifespan
)
const maxExpiration = new Date(now + config.quoteLifespan)
expect(quote).toMatchObject({
walletAddressId: sendingWalletAddress.id,
receiver: options.receiver,
Expand Down
Loading

0 comments on commit 0ee9794

Please sign in to comment.