Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/cli-kit/src/private/node/conf-store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
getCachedPartnerAccountStatus,
setCachedPartnerAccountStatus,
runWithRateLimit,
timeIntervalToMilliseconds,
} from './conf-store.js'
import {isLocalEnvironment} from './context/service.js'
import {LocalStorage} from '../../public/node/local-storage.js'
Expand Down Expand Up @@ -548,6 +549,7 @@ describe('runWithRateLimit', () => {
test('runs the task as usual when the cache is populated but outdated', async () => {
await inTemporaryDirectory(async (cwd) => {
// Given
vi.useFakeTimers()
const config = new LocalStorage<any>({cwd})
for (let i = 0; i < limit; i++) {
// eslint-disable-next-line no-await-in-loop
Expand All @@ -564,7 +566,8 @@ describe('runWithRateLimit', () => {

// When
let taskRan = false
vi.setSystemTime(vi.getRealSystemTime() + 1000)
// The rate-limit window is inclusive of its start, so advance strictly past it.
vi.advanceTimersByTime(timeIntervalToMilliseconds(timeout) + 1)
const got = await runWithRateLimit(
{
key,
Expand Down
Loading