Skip to content

Commit

Permalink
Merge pull request #11485 from qmonmert/emitterstub
Browse files Browse the repository at this point in the history
Refacto: EmitterStub
  • Loading branch information
murdos authored Dec 2, 2024
2 parents 78e1478 + 6532836 commit 9a6a112
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Emitter } from 'mitt';
import sinon, { SinonStub } from 'sinon';
import { vi } from 'vitest';

interface EmitterStub extends Emitter<any> {
emit: SinonStub;
emit: vi.fn;
}

export const stubEmitter = (): EmitterStub =>
({
emit: sinon.stub(),
emit: vi.fn(),
}) as EmitterStub;
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import { AlertType } from '@/shared/alert/infrastructure/secondary/AlertType';
import { MittAlertBus } from '@/shared/alert/infrastructure/secondary/MittAlertBus';
import { Emitter } from 'mitt';
import { describe, expect, it, vi } from 'vitest';

interface EmitterStub extends Emitter<any> {
emit: vi.fn;
}

const stubEmitter = (): EmitterStub =>
({
emit: vi.fn(),
}) as EmitterStub;
import { describe, expect, it } from 'vitest';
import { stubEmitter } from './EmitterStub.fixture';

describe('MittAlertBus', () => {
it('should emit success', () => {
Expand Down

0 comments on commit 9a6a112

Please sign in to comment.