-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(createStatsDClient): Return full StatsD type (#51)
BREAKING CHANGE: the `StatsD` class must be passed as the first argument of the factory function. The return type will reflect the input type, so you don't need to perform a type assertion `as StatsD` anymore. ```diff import { StatsD } from 'hot-shots'; import { createStatsDClient } from 'seek-datadog-custom-metrics'; - export const metricsClient = createStatsDClient(config, errHandler) as StatsD; + export const metricsClient = createStatsDClient(StatsD, config, errHandler); ```
- Loading branch information
Showing
4 changed files
with
33 additions
and
14 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
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,9 +1,15 @@ | ||
import { StatsD } from 'hot-shots'; | ||
|
||
import createStatsDClient from './createStatsDClient'; | ||
|
||
describe('createStatsDClient', () => { | ||
it('should create a new mock client', () => { | ||
expect( | ||
createStatsDClient({ name: 'test', environment: 'jest', version: '0' }), | ||
createStatsDClient(StatsD, { | ||
name: 'test', | ||
environment: 'jest', | ||
version: '0', | ||
}), | ||
).toBeInstanceOf(Object); | ||
}); | ||
}); |
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