Skip to content

Commit

Permalink
refact: fix jest deprecation toBeCalled -> toHaveBeenCalled
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpza committed Aug 6, 2024
1 parent faedb50 commit 298f137
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/tests/register.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe(`Register script`, () => {

register.initialize();

expect(registerSpy).toBeCalledTimes(1);
expect(registerSpy).toHaveBeenCalledTimes(1);
expect(registerSpy.mock.calls[0]).toHaveLength(0);
expect(global.process[instanceSymbol]).not.toBeUndefined();
} finally {
Expand All @@ -70,7 +70,7 @@ describe(`Register script`, () => {

const { tsNodeInstance } = register.initialize();

expect(registerSpy).not.toBeCalled();
expect(registerSpy).not.toHaveBeenCalled();
expect(tsNodeInstance).toBe(fakeInstance);
} finally {
global.process[instanceSymbol] = originalTsNodeInstance;
Expand Down Expand Up @@ -193,8 +193,8 @@ describe(`Register script`, () => {

if (existingTransformers === transformerFactoryFn)
test(`Factory config instantiated with program`, () => {
expect(transformerFactoryFn).toBeCalledTimes(1);
expect(transformerFactoryFn).toBeCalledWith(fakeProgram);
expect(transformerFactoryFn).toHaveBeenCalledTimes(1);
expect(transformerFactoryFn).toHaveBeenCalledWith(fakeProgram);
});

test(`Registers correct transformers`, () => {
Expand All @@ -221,7 +221,7 @@ describe(`Register script`, () => {
existingTransformers === transformerFactoryFn ? " & Program" : ""
}`, () => {
const callTimes = +hasBefore + +hasAfterDeclarations;
expect(mockTransformer).toBeCalledTimes(callTimes);
expect(mockTransformer).toHaveBeenCalledTimes(callTimes);

const afterDeclarationsConfig = transformers.find(
(t) => t.transform === "typescript-transform-paths" && t.afterDeclarations,
Expand Down

0 comments on commit 298f137

Please sign in to comment.