Skip to content
GitHub

testCooldownStore

function in meocord/testing Since 4.1.0

testCooldownStore(
  name: string,
  factory: () => CooldownStore | Promise<CooldownStore>,
  framework: CooldownStoreSuiteFramework,
): void

Checks that a CooldownStore counts calls as MemoryCooldownStore does, as a suite of test cases.

Use it for a store you write over a database, or one you configure, such as Redis. It registers one describe of cases with the framework you pass, so it runs under Vitest, Jest or any runner with the same three functions.

Parameters

NameTypeDescription
namestring

What the store is called in the report.

factory() => CooldownStore | Promise<CooldownStore>

Makes the store to check, once per case.

frameworkCooldownStoreSuiteFramework

The test framework's describe, it and expect.

Examples

TypeScript
import { describe, expect, it } from 'vitest'

testCooldownStore('MemoryCooldownStore', () => new MemoryCooldownStore(), { describe, it, expect })