-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- This fixes all remaining type errors in unit tests while also adding a step in the pipeline to check the types for unit tests as well. - Fix recentlyViewed isLoading reducer which was not returning false when handling error action types. - Fix some exported types. - Changed renderContent to return a Fragment instead of an array of elements.
- Loading branch information
Showing
259 changed files
with
2,889 additions
and
2,066 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { Integration } from '../integrations'; | ||
import { logger } from '../utils'; | ||
import { mockUsersResponse } from 'tests/__fixtures__/users'; | ||
import { PACKAGE_NAME } from '../utils/constants'; | ||
import Analytics from '../'; | ||
import eventTypes from '../types/eventTypes'; | ||
|
@@ -235,7 +236,7 @@ describe('analytics', () => { | |
}); | ||
|
||
it('should log an error when calling `analytics.setUser`', async () => { | ||
await analytics.setUser(123456, {}); | ||
await analytics.setUser(123456, mockUsersResponse); | ||
|
||
expect(loggerErrorSpy).toHaveBeenCalledTimes(1); | ||
|
||
|
@@ -631,14 +632,13 @@ describe('analytics', () => { | |
describe('User', () => { | ||
it("Should return user's data", async () => { | ||
const userId = 1; | ||
const traits = { isGuest: false }; | ||
|
||
await analytics.setUser(userId, traits); | ||
await analytics.setUser(userId, mockUsersResponse); | ||
|
||
const userData = (await analytics.user()) as UserData; | ||
|
||
expect(userData['id']).toEqual(userId); | ||
expect(userData['traits']).toEqual(traits); | ||
expect(userData['traits']).toEqual(mockUsersResponse); | ||
}); | ||
|
||
it("Should return user's empty data structure if there's no data on storage", async () => { | ||
|
@@ -668,22 +668,18 @@ describe('analytics', () => { | |
expect(user.localId).not.toBeNull(); | ||
|
||
const userId = 12345678; | ||
const traits = { | ||
name: 'Foo', | ||
email: '[email protected]', | ||
}; | ||
|
||
await analytics.setUser(userId, traits); | ||
await analytics.setUser(userId, mockUsersResponse); | ||
|
||
user = (await analytics.user()) as UserData; | ||
|
||
expect(user.id).toEqual(userId); | ||
expect(user.traits).toEqual(traits); | ||
expect(user.traits).toEqual(mockUsersResponse); | ||
expect(user.localId).not.toBeNull(); | ||
}); | ||
|
||
it('Should anonymize an user', async () => { | ||
await analytics.setUser(12345678, { name: 'Dummy' }); | ||
await analytics.setUser(12345678, mockUsersResponse); | ||
|
||
const currentLocalId = ((await analytics.user()) as UserData).localId; | ||
|
||
|
@@ -733,7 +729,7 @@ describe('analytics', () => { | |
it('Should log an error message if setUser method throws', async () => { | ||
await setupAnalyticsWithFaultyStorage(); | ||
|
||
await analytics.setUser(12, { isGuest: false }); | ||
await analytics.setUser(12, mockUsersResponse); | ||
|
||
expect(loggerErrorSpy).toHaveBeenCalledTimes(1); | ||
expect(loggerErrorSpy).toBeCalledWith( | ||
|
@@ -776,12 +772,7 @@ describe('analytics', () => { | |
); | ||
|
||
const userId = 12345678; | ||
const traits = { | ||
name: 'Foo', | ||
email: '[email protected]', | ||
}; | ||
|
||
await analytics.setUser(userId, traits); | ||
await analytics.setUser(userId, mockUsersResponse); | ||
|
||
expect(spyIntegration1).toBeCalled(); | ||
expect(spyIntegration2).toBeCalled(); | ||
|
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 @@ | ||
import { mockUsersResponse } from 'tests/__fixtures__/users'; | ||
import { StorageWrapper } from '../utils'; | ||
import TestStorage from 'test-storage'; | ||
import User from '../User'; | ||
|
@@ -32,7 +33,7 @@ describe('User', () => { | |
}); | ||
|
||
it('Should delete the user', async () => { | ||
await userInstance.set(123123, { name: 'foo' }); | ||
await userInstance.set(123123, mockUsersResponse); | ||
const beforeAnonymizeLocalId = await userInstance.localId(); | ||
|
||
await userInstance.anonymize(); | ||
|
@@ -46,17 +47,13 @@ describe('User', () => { | |
|
||
it('Should identify an user with parameters', async () => { | ||
const userId = 12345678; | ||
const traits = { | ||
name: 'Foo', | ||
email: '[email protected]', | ||
}; | ||
|
||
await userInstance.set(userId, traits); | ||
await userInstance.set(userId, mockUsersResponse); | ||
|
||
const data = await userInstance.get(); | ||
|
||
expect(data.id).toBe(userId); | ||
expect(data.traits).toMatchObject(traits); | ||
expect(data.traits).toMatchObject(mockUsersResponse); | ||
}); | ||
|
||
it('Should create a local ID and store it on the storage', async () => { | ||
|
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
File renamed without changes.
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
4 changes: 2 additions & 2 deletions
4
packages/client/src/checkout/__fixtures__/getCheckoutOrderOperations.fixtures.ts
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
Oops, something went wrong.