Skip to content

Commit

Permalink
wrapped all functions with jest fn
Browse files Browse the repository at this point in the history
  • Loading branch information
RevanToma committed Oct 2, 2024
1 parent 7b55b1b commit 6646791
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/bull/ZembleQueueMock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* eslint-disable functional/prefer-readonly-type */

import zembleContext from '@zemble/core/zembleContext'
import { jest } from 'bun:test'

import type { ZembleQueueBull, ZembleQueueConfig, ZembleWorker } from './ZembleQueueBull'
import type {
Expand All @@ -28,6 +29,14 @@ class ZembleQueueMock<DataType = unknown, ReturnType = unknown> implements IZemb
) {
this.#worker = worker
// this.#config = config

// wrap all functions with jest.fn to be able to spy on them
this.add = jest.fn(this.add.bind(this))
this.addBulk = jest.fn(this.addBulk.bind(this))
this.remove = jest.fn(this.remove.bind(this))
this.getJob = jest.fn(this.getJob.bind(this))
this.pause = jest.fn(this.pause.bind(this))
this.resume = jest.fn(this.resume.bind(this))
}

readonly #worker: ZembleWorker
Expand Down

0 comments on commit 6646791

Please sign in to comment.