-
Notifications
You must be signed in to change notification settings - Fork 9
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
Johanblumenberg matcher types #8
base: master
Are you sure you want to change the base?
Johanblumenberg matcher types #8
Conversation
…-mockito into johanblumenberg-matcher-types # Conflicts: # src/ts-mockito.ts # test/matcher/type/DeepEqualMatcher.spec.ts
Codecov Report
@@ Coverage Diff @@
## master #8 +/- ##
==========================================
+ Coverage 93.41% 93.64% +0.23%
==========================================
Files 34 36 +2
Lines 653 677 +24
Branches 80 84 +4
==========================================
+ Hits 610 634 +24
Misses 30 30
Partials 13 13
Continue to review full report at Codecov.
|
src/matcher/type/EndsWithMatcher.ts
Outdated
super(); | ||
} | ||
|
||
public match(value: Object): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value should be string IMO
src/matcher/type/EndsWithMatcher.ts
Outdated
import { Matcher } from "./Matcher"; | ||
|
||
export class EndsWithMatcher extends Matcher { | ||
constructor(private expectedValue: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expectedValue should be string
import { Matcher } from "./Matcher"; | ||
|
||
export class StartsWithMatcher extends Matcher { | ||
constructor(private expectedValue: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same type related comments as in endsWithMatcher..
src/ts-mockito.ts
Outdated
return new MatchingStringMatcher(expectedValue) as any; | ||
} | ||
|
||
export function startsWith(expectedValue: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should return Matcher and no need for the any casting
src/ts-mockito.ts
Outdated
} | ||
|
||
export function endsWith(expectedValue: string): string { | ||
return new EndsWithMatcher(expectedValue) as any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
test/MethodAction.spec.ts
Outdated
@@ -12,7 +12,7 @@ describe("MethodAction", () => { | |||
const testObj: MethodAction = new MethodAction(methodName, [firstArg, secondArg]); | |||
|
|||
// when | |||
const result = testObj.isApplicable(methodName, [strictEqual(firstArg), strictEqual(secondArg)]); | |||
const result = testObj.isApplicable(methodName, [strictEqual(firstArg) as any, strictEqual(secondArg) as any]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strictEqual should return Matcher and there's no need for casting to any
@cspotcode I fixed some of the types in the original PR, a matcher function should return a matcher type not any, the tests were actually expected a matcher. |
Is there a reason to no merge this? besides conflicts? |
@roypeled Not that I remember |
No description provided.