-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from Roaders/exposeLookupTypes
Expose lookup types
- Loading branch information
Showing
11 changed files
with
916 additions
and
1,063 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
coverage: | ||
precision: 2 | ||
round: down | ||
range: "80...100" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './property-replacement-helper'; | ||
export * from './module-helper'; | ||
export * from './jest-helper'; | ||
export * from './lookup-helper'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { ConstructorFunction, FunctionCallLookup, IMocked, LookupType } from '../mock'; | ||
|
||
export function getLookup<T, C extends ConstructorFunction<T>, U extends LookupType>( | ||
mock: IMocked<T, C>, | ||
lookupType: U, | ||
): FunctionCallLookup<T, C, U> { | ||
switch (lookupType) { | ||
case 'function': | ||
return mock.functionCallLookup as FunctionCallLookup<T, C, U>; | ||
case 'getter': | ||
return mock.getterCallLookup as FunctionCallLookup<T, C, U>; | ||
case 'setter': | ||
return mock.setterCallLookup as FunctionCallLookup<T, C, U>; | ||
case 'staticFunction': | ||
return mock.staticFunctionCallLookup as FunctionCallLookup<T, C, U>; | ||
case 'staticGetter': | ||
return mock.staticGetterCallLookup as FunctionCallLookup<T, C, U>; | ||
case 'staticSetter': | ||
return mock.staticSetterCallLookup as FunctionCallLookup<T, C, U>; | ||
} | ||
throw new Error(`Unknown lookup type: ${lookupType}`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.