-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Refactor test set up for readability (#810)
- Loading branch information
Showing
36 changed files
with
127 additions
and
120 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
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,31 @@ | ||
// Import set up logic | ||
import './config/setup'; | ||
|
||
// Import each test module | ||
import './tests-core-sdk'; | ||
import './tests-batchUploader'; | ||
import './tests-beaconUpload'; | ||
import './tests-kit-blocking'; | ||
import './tests-persistence'; | ||
import './tests-forwarders'; | ||
import './tests-helpers'; | ||
import './tests-identity'; | ||
import './tests-event-logging'; | ||
import './tests-eCommerce'; | ||
import './tests-cookie-syncing'; | ||
import './tests-identities-attributes'; | ||
import './tests-native-sdk'; | ||
import './tests-consent'; | ||
import './tests-serverModel'; | ||
import './tests-mockBatchCreator'; | ||
import './tests-mParticleUser'; | ||
import './tests-self-hosting-specific'; | ||
import './tests-runtimeToBatchEventsDTO'; | ||
import './tests-apiClient'; | ||
import './tests-mparticle-instance-manager'; | ||
import './tests-queue-public-methods'; | ||
import './tests-validators'; | ||
import './tests-utils'; | ||
import './tests-session-manager'; | ||
import './tests-store'; | ||
import './tests-config-api-client'; |
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,38 @@ | ||
import { MPConfig, workspaceToken } from './constants'; | ||
import { MParticleWebSDK } from '../../../src/sdkRuntimeModels'; | ||
|
||
declare global { | ||
interface Window { | ||
mParticle: MParticleWebSDK; | ||
} | ||
} | ||
|
||
let userApi = null; | ||
|
||
window.mParticle._isTestEnv = true; | ||
|
||
beforeEach(function() { | ||
// mocha can't clean up after itself, so this lets | ||
// tests mock the current user and restores in between runs. | ||
if (!userApi) { | ||
userApi = window.mParticle.getInstance().Identity.getCurrentUser; | ||
} else { | ||
window.mParticle.getInstance().Identity.getCurrentUser = userApi; | ||
} | ||
|
||
window.mParticle.config = { | ||
workspaceToken: workspaceToken, | ||
logLevel: 'none', | ||
kitConfigs: [], | ||
requestConfig: false, | ||
isDevelopmentMode: false, | ||
flags: { | ||
eventBatchingIntervalMillis: 0, | ||
} | ||
}; | ||
|
||
// This is to tell the resetPersistence method that we are in a test environment | ||
// It should probably be refactored to be included as an argument | ||
window.mParticle._resetForTests(MPConfig); | ||
delete window.mParticle._instances['default_instance']; | ||
}); |
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
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
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.