-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Add disable API boolean (#992)
- @segment/analytics-signals-runtime@1.1.1
- @segment/analytics-signals-runtime@1.1.0
- @segment/analytics-signals-runtime@1.0.0
- @segment/analytics-signals@1.8.0
- @segment/analytics-signals@1.7.1
- @segment/analytics-signals@1.7.0
- @segment/analytics-signals@1.6.0
- @segment/analytics-signals@1.5.1
- @segment/analytics-signals@1.5.0
- @segment/analytics-signals@1.4.0
- @segment/analytics-signals@1.3.0
- @segment/analytics-signals@1.2.0
- @segment/analytics-signals@1.1.0
- @segment/analytics-signals@1.0.1
- @segment/analytics-signals@1.0.0
- @segment/analytics-signals@0.1.1
- @segment/analytics-signals@0.1.0
- @segment/analytics-signals@0.0.1
- @segment/analytics-node@2.2.0
- @segment/analytics-node@2.1.3
- @segment/analytics-node@2.1.2
- @segment/analytics-node@2.1.1
- @segment/analytics-node@2.1.0
- @segment/analytics-node@2.0.0
- @segment/analytics-node@1.3.0
- @segment/analytics-node@1.2.0
- @segment/analytics-node@1.1.4
- @segment/analytics-next@1.76.0
- @segment/analytics-next@1.75.0
- @segment/analytics-next@1.74.0
- @segment/analytics-next@1.73.0
- @segment/analytics-next@1.72.2
- @segment/analytics-next@1.72.1
- @segment/analytics-next@1.72.0
- @segment/analytics-next@1.71.0
- @segment/analytics-next@1.70.0
- @segment/analytics-next@1.69.0
- @segment/analytics-next@1.68.0
- @segment/analytics-next@1.67.0
- @segment/analytics-next@1.66.0
- @segment/analytics-next@1.64.0
- @segment/analytics-next@1.63.0
- @segment/analytics-next@1.62.1
- @segment/analytics-next@1.62.0
- @segment/analytics-generic-utils@1.2.0
- @segment/analytics-generic-utils@1.1.1
- @segment/analytics-generic-utils@1.1.0
- @segment/analytics-core@1.8.0
- @segment/analytics-core@1.7.0
- @segment/analytics-core@1.6.0
- @segment/analytics-core@1.5.1
- @segment/analytics-core@1.5.0
- @segment/analytics-core@1.4.1
- @segment/analytics-core@1.4.0
- @segment/analytics-consent-wrapper-onetrust@1.1.1
- @segment/analytics-consent-wrapper-onetrust@1.1.0
- @segment/analytics-consent-wrapper-onetrust@1.0.1
- @segment/analytics-consent-wrapper-onetrust@1.0.0
- @segment/analytics-consent-wrapper-onetrust@0.4.1
- @segment/analytics-consent-wrapper-onetrust@0.4.0
- @segment/analytics-consent-wrapper-onetrust@0.3.3
- @segment/analytics-consent-tools@2.0.1
- @segment/analytics-consent-tools@2.0.0
- @segment/analytics-consent-tools@1.2.0
- @segment/analytics-consent-tools@1.1.0
Showing
7 changed files
with
144 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@segment/analytics-next': patch | ||
--- | ||
|
||
Add 'disable' boolean option to allow for disabling Segment in a testing environment. |
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.
37 changes: 37 additions & 0 deletions
37
packages/browser/src/core/analytics/__tests__/null-analytics.test.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { getAjsBrowserStorage } from '../../../test-helpers/browser-storage' | ||
import { Analytics, NullAnalytics } from '..' | ||
|
||
describe(NullAnalytics, () => { | ||
it('should return an instance of Analytics / NullAnalytics', () => { | ||
const analytics = new NullAnalytics() | ||
expect(analytics).toBeInstanceOf(Analytics) | ||
expect(analytics).toBeInstanceOf(NullAnalytics) | ||
}) | ||
|
||
it('should have initialized set to true', () => { | ||
const analytics = new NullAnalytics() | ||
expect(analytics.initialized).toBe(true) | ||
}) | ||
|
||
it('should have no plugins', async () => { | ||
const analytics = new NullAnalytics() | ||
expect(analytics.queue.plugins).toHaveLength(0) | ||
}) | ||
it('should dispatch events', async () => { | ||
const analytics = new NullAnalytics() | ||
const ctx = await analytics.track('foo') | ||
expect(ctx.event.event).toBe('foo') | ||
}) | ||
|
||
it('should have disableClientPersistence set to true', () => { | ||
const analytics = new NullAnalytics() | ||
expect(analytics.options.disableClientPersistence).toBe(true) | ||
}) | ||
|
||
it('integration: should not touch cookies or localStorage', async () => { | ||
const analytics = new NullAnalytics() | ||
await analytics.track('foo') | ||
const storage = getAjsBrowserStorage() | ||
expect(Object.values(storage).every((v) => !v)).toBe(true) | ||
}) | ||
}) |
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