fix(analytics): fix tests and add new ones for getServiceByEnvironment

This commit is contained in:
Matteo Pagliazzi
2020-11-30 11:39:39 +01:00
parent 7745a0e65a
commit 4e9a2de527
2 changed files with 23 additions and 6 deletions

View File

@@ -32,8 +32,8 @@ describe('payments/index', () => {
sandbox.stub(sender, 'sendTxn');
sandbox.stub(user, 'sendMessage');
sandbox.stub(analytics, 'trackPurchase');
sandbox.stub(analytics, 'track');
sandbox.stub(analytics.mockAnalyticsService, 'trackPurchase');
sandbox.stub(analytics.mockAnalyticsService, 'track');
sandbox.stub(notifications, 'sendNotification');
data = {
@@ -237,8 +237,8 @@ describe('payments/index', () => {
it('tracks subscription purchase as gift', async () => {
await api.createSubscription(data);
expect(analytics.trackPurchase).to.be.calledOnce;
expect(analytics.trackPurchase).to.be.calledWith({
expect(analytics.mockAnalyticsService.trackPurchase).to.be.calledOnce;
expect(analytics.mockAnalyticsService.trackPurchase).to.be.calledWith({
uuid: user._id,
groupId: undefined,
itemPurchased: 'Subscription',
@@ -335,8 +335,8 @@ describe('payments/index', () => {
it('tracks subscription purchase', async () => {
await api.createSubscription(data);
expect(analytics.trackPurchase).to.be.calledOnce;
expect(analytics.trackPurchase).to.be.calledWith({
expect(analytics.mockAnalyticsService.trackPurchase).to.be.calledOnce;
expect(analytics.mockAnalyticsService.trackPurchase).to.be.calledWith({
uuid: user._id,
groupId: undefined,
itemPurchased: 'Subscription',