-
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.
* Add telemetry posting * Post telemetry stats * Added cacheKeys and cacheSize
- Loading branch information
Showing
8 changed files
with
115 additions
and
16 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
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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import Supergood from '../../src'; | ||
import { mockApi } from '../utils/mock-api'; | ||
import axios from 'axios'; | ||
|
||
import { | ||
MOCK_DATA_SERVER, | ||
SUPERGOOD_CLIENT_ID, | ||
SUPERGOOD_CLIENT_SECRET, | ||
SUPERGOOD_CONFIG, | ||
SUPERGOOD_SERVER | ||
} from '../consts'; | ||
import { getTelemetry } from '../utils/function-call-args'; | ||
|
||
describe('telemetry posting', () => { | ||
const { postTelemetryMock } = mockApi(); | ||
it('should accurately post telemetry', async () => { | ||
await Supergood.init( | ||
{ | ||
config: { ...SUPERGOOD_CONFIG, allowLocalUrls: true }, | ||
clientId: SUPERGOOD_CLIENT_ID, | ||
clientSecret: SUPERGOOD_CLIENT_SECRET, | ||
metadata: { | ||
serviceName: "test-service-name", | ||
} | ||
}, | ||
SUPERGOOD_SERVER | ||
); | ||
await axios.get(`${MOCK_DATA_SERVER}/posts`); | ||
await Supergood.close(); | ||
const { cacheKeys, cacheSize, serviceName } = getTelemetry(postTelemetryMock); | ||
expect(cacheKeys).toEqual(1); | ||
expect(cacheSize).toEqual(160); | ||
expect(serviceName).toEqual("test-service-name"); | ||
}) | ||
|
||
}) |
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