Skip to content

Commit

Permalink
Biome fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ilovepixelart committed Dec 10, 2024
1 parent 46eb8b3 commit 849a322
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/helpers.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { describe, it, expect, vi, afterEach, beforeEach } from 'vitest'
import { useTTL } from '../src/helpers'
import History from '../src/models/History'
import ms from 'ms'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'

import History from '../src/models/History'

import { useTTL } from '../src/helpers'

import type { Mock, MockInstance } from 'vitest'

vi.mock('../src/models/History', () => ({
default: {
default: {
collection: {
indexes: vi.fn(),
dropIndex: vi.fn(),
Expand Down Expand Up @@ -66,7 +68,7 @@ describe('useTTL', () => {

const expireAfterSecondsBefore = ms(ttlBefore) / 1000
const expireAfterSecondsAfter = ms(ttlAfter) / 1000

indexes.mockResolvedValue([{ name, expireAfterSeconds: expireAfterSecondsBefore }])
const opts = { historyTTL: ttlAfter }

Expand All @@ -77,11 +79,11 @@ describe('useTTL', () => {

it('should create the index if it does not exist', async () => {
const opts = { historyTTL: '1h' }
const expireAfterSeconds = ms(opts.historyTTL) / 1000;
const expireAfterSeconds = ms(opts.historyTTL) / 1000

indexes.mockResolvedValue([])

await useTTL(opts)
expect(createIndexSpy).toHaveBeenCalledWith({ createdAt: 1 }, { expireAfterSeconds, name })
})
})
})

0 comments on commit 849a322

Please sign in to comment.