Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError when using match with a string #224

Open
mlntdrv opened this issue Feb 3, 2022 · 0 comments
Open

TypeError when using match with a string #224

mlntdrv opened this issue Feb 3, 2022 · 0 comments

Comments

@mlntdrv
Copy link

mlntdrv commented Feb 3, 2022

import { match, mock, when } from 'ts-mockito';
import { SomeClass } from 'some-class';
import { Observable } from 'rxjs';

const SomeClassMock: SomeClass = mock(SomeClass);

when(SomeClassMock.method<boolean>(match('/x/y/'))).thenReturn(
  new Observable<boolean>()
);

TypeError: Cannot read property 'match' of null
at MatchingStringMatcher.match (.../node_modules/ts-mockito/src/matcher/type/MatchingStringMatcher.ts:9:22)
at .../node_modules/ts-mockito/src/matcher/ArgsToMatchersValidator.ts:8:76
at Array.every ()
at ArgsToMatchersValidator.validate (.../node_modules/ts-mockito/src/matcher/ArgsToMatchersValidator.ts:8:25)
at ReturnValueMethodStub.isApplicable (.../node_modules/ts-mockito/src/stub/ReturnValueMethodStub.ts:14:31)
at .../node_modules/ts-mockito/src/MethodStubCollection.ts:23:59
at Array.some ()
at MethodStubCollection.hasMatchingInAnyGroup (.../node_modules/ts-mockito/src/MethodStubCollection.ts:23:27)
at Mocker.getMethodStub (.../node_modules/ts-mockito/src/Mock.ts:238:38)
at Proxy. (.../node_modules/ts-mockito/src/Mock.ts:161:37)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant