Skip to content

Commit

Permalink
test: apply recent changes
Browse files Browse the repository at this point in the history
1. account time in minutes
2. browser diagnostic default apiKey
  • Loading branch information
Mercy811 committed Oct 17, 2023
1 parent 03be784 commit 615c71a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/analytics-browser/test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('config', () => {
transport: 'fetch',
transportProvider: new FetchTransport(),
useBatch: false,
diagnosticProvider: new BrowserDiagnostic(),
diagnosticProvider: new BrowserDiagnostic({ apiKey }),
});
});

Expand Down Expand Up @@ -135,7 +135,7 @@ describe('config', () => {
transport: 'fetch',
transportProvider: new FetchTransport(),
useBatch: false,
diagnosticProvider: new BrowserDiagnostic(),
diagnosticProvider: new BrowserDiagnostic({ apiKey }),
});
expect(getTopLevelDomain).toHaveBeenCalledTimes(1);
});
Expand Down Expand Up @@ -220,7 +220,7 @@ describe('config', () => {
transport: 'fetch',
transportProvider: new FetchTransport(),
useBatch: false,
diagnosticProvider: new BrowserDiagnostic(),
diagnosticProvider: new BrowserDiagnostic({ apiKey }),
});
});

Expand Down
6 changes: 3 additions & 3 deletions packages/analytics-browser/test/diagnostic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('Diagnostic', () => {
test('should fetch', async () => {
const diagnostic = new BrowserDiagnostic();
const fetchMock = jest.fn().mockResolvedValueOnce({} as Response);
Date.now = jest.fn().mockReturnValue(12345);
Date.now = jest.fn().mockReturnValue(1697583342266);
global.fetch = fetchMock;

diagnostic.track(5, 400, 'test message 0');
Expand All @@ -24,7 +24,7 @@ describe('Diagnostic', () => {
{
metadata_type: DIAGNOSTIC_METADATA_TYPE,
library: 'amplitude-ts',
accounting_time_min: 12345,
accounting_time_min: Math.floor(1697583342266 / 60 / 1000),
response_code: 400,
trigger: 'test message 0',
action: 'drop events',
Expand All @@ -33,7 +33,7 @@ describe('Diagnostic', () => {
{
metadata_type: DIAGNOSTIC_METADATA_TYPE,
library: 'amplitude-ts',
accounting_time_min: 12345,
accounting_time_min: Math.floor(1697583342266 / 60 / 1000),
response_code: 500,
trigger: 'test message 1',
action: 'drop events',
Expand Down

0 comments on commit 615c71a

Please sign in to comment.