NagRock / ts-mockito

Mocking library for TypeScript
MIT License
977 stars 93 forks source link

Matcher types #139

Open johanblumenberg opened 5 years ago

johanblumenberg commented 5 years ago

Add startsWith() and endsWith() string matchers.

Update types on matchers for better type safety.

For example, before this PR, this would be compiling, even though it is invalid code:

class Foo {
  bar(value: { a: string }) {}
}

let foo = mock(Foo);
verify(foo.bar(deepEquals('hello world')).called();
codecov-io commented 5 years ago

Codecov Report

Merging #139 into master will increase coverage by 0.19%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #139      +/-   ##
==========================================
+ Coverage   94.93%   95.12%   +0.19%     
==========================================
  Files          34       36       +2     
  Lines         612      636      +24     
  Branches       71       75       +4     
==========================================
+ Hits          581      605      +24     
  Misses         22       22              
  Partials        9        9
Impacted Files Coverage Δ
src/matcher/type/StartsWithMatcher.ts 100% <100%> (ø)
src/ts-mockito.ts 97.01% <100%> (+0.29%) :arrow_up:
src/matcher/type/EndsWithMatcher.ts 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 245892c...e59b0c8. Read the comment docs.