@friggframework/api-module-pipedrive 0.8.24 → 0.8.25-canary.143.04e6974.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.8.24",
2
+ "version": "0.8.25-canary.143.04e6974.0",
3
3
  "name": "@friggframework/api-module-pipedrive",
4
4
  "prettier": "@friggframework/prettier-config",
5
5
  "description": "",
@@ -11,16 +11,16 @@
11
11
  "author": "",
12
12
  "license": "MIT",
13
13
  "devDependencies": {
14
- "@friggframework/eslint-config": "^1.0.8",
15
- "@friggframework/test-environment": "^1.1.6",
14
+ "@friggframework/eslint-config": "1.0.9-canary.143.04e6974.0",
15
+ "@friggframework/test-environment": "1.1.7-canary.143.04e6974.0",
16
16
  "eslint": "^8.22.0",
17
17
  "jest": "^28.1.3",
18
18
  "prettier": "^2.7.1",
19
19
  "sinon": "^14.0.0"
20
20
  },
21
21
  "dependencies": {
22
- "@friggframework/assertions": "^1.0.8",
23
- "@friggframework/module-plugin": "^1.0.25"
22
+ "@friggframework/assertions": "1.0.9-canary.143.04e6974.0",
23
+ "@friggframework/module-plugin": "1.0.26-canary.143.04e6974.0"
24
24
  },
25
- "gitHead": "f4e7870c0881b93e950eadc569192d122f5f2534"
25
+ "gitHead": "04e6974da8d19972f8b4124d2bcb0f4f8e720bca"
26
26
  }
package/test/Api.test.js CHANGED
@@ -2,7 +2,8 @@ const chai = require('chai');
2
2
  const { expect } = chai;
3
3
  const should = chai.should();
4
4
  const { Api } = require('../api');
5
- const { mockApi } = require('../../../../test/utils/mockApi');
5
+
6
+ const { mockApi } = require('@friggframework/test-environment/mock-api');
6
7
 
7
8
  const MockedApi = mockApi(Api, {
8
9
  authenticationMode: 'browser',
@@ -11,18 +12,18 @@ const MockedApi = mockApi(Api, {
11
12
  },
12
13
  });
13
14
 
14
- describe('Pipedrive API class', async () => {
15
+ describe.skip('Pipedrive API class', () => {
15
16
  let api;
16
- before(async function () {
17
- await MockedApi.initialize({ test: this.test });
17
+ beforeAll(async function () {
18
+ await MockedApi.initialize();
18
19
  api = await MockedApi.mock();
19
20
  });
20
21
 
21
- after(async function () {
22
- await MockedApi.clean({ test: this.test });
22
+ afterAll(async function () {
23
+ await MockedApi.clean();
23
24
  });
24
25
 
25
- describe('User', async () => {
26
+ describe('User', () => {
26
27
  it('should list user profile', async () => {
27
28
  const response = await api.getUser();
28
29
  chai.assert.hasAllKeys(response.data, [
@@ -54,7 +55,7 @@ describe('Pipedrive API class', async () => {
54
55
  });
55
56
  });
56
57
 
57
- describe('Deals', async () => {
58
+ describe('Deals', () => {
58
59
  it('should list deals', async () => {
59
60
  const response = await api.listDeals();
60
61
  response.data.length.should.above(0);
@@ -63,7 +64,7 @@ describe('Pipedrive API class', async () => {
63
64
  });
64
65
  });
65
66
 
66
- describe('Activities', async () => {
67
+ describe('Activities', () => {
67
68
  const mockActivity = {};
68
69
  it('should list all Activity Fields', async () => {
69
70
  const response = await api.listActivityFields();
@@ -97,7 +98,7 @@ describe('Pipedrive API class', async () => {
97
98
  });
98
99
  });
99
100
 
100
- describe('Users', async () => {
101
+ describe('Users', () => {
101
102
  it('should get users', async () => {
102
103
  const response = await api.listUsers();
103
104
  response.data.should.be.an('array').of.length.greaterThan(0);
@@ -126,7 +127,7 @@ describe('Pipedrive API class', async () => {
126
127
  });
127
128
  });
128
129
 
129
- describe('Bad Auth', async () => {
130
+ describe('Bad Auth', () => {
130
131
  it('should refresh bad auth token', async () => {
131
132
  // Needed to paste a valid JWT, otherwise it's testing the wrong error.
132
133
  // TODO expand on other error types.
@@ -1,17 +1,17 @@
1
1
  const chai = require('chai');
2
2
  const { expect } = chai;
3
3
  const PipedriveManager = require('../manager');
4
- const Authenticator = require('../../../../test/utils/Authenticator');
5
- const TestUtils = require('../../../../test/utils/TestUtils');
4
+ const Authenticator = require('@friggframework/test-environment/Authenticator');
5
+ const mongoose = require("mongoose");
6
6
 
7
7
  // eslint-disable-next-line no-only-tests/no-only-tests
8
- describe('Pipedrive Manager', async () => {
9
- let manager;
10
- before(async () => {
11
- this.userManager = await TestUtils.getLoggedInTestUserManagerInstance();
8
+ describe.skip('Pipedrive Manager', () => {
9
+ let manager, userId;
10
+ beforeAll(async () => {
11
+ userId = new mongoose.Types.ObjectId();
12
12
 
13
13
  manager = await PipedriveManager.getInstance({
14
- userId: this.userManager.getUserId(),
14
+ userId,
15
15
  });
16
16
  const res = await manager.getAuthorizationRequirements();
17
17
 
@@ -23,13 +23,13 @@ describe('Pipedrive Manager', async () => {
23
23
  delete response.base;
24
24
 
25
25
  const ids = await manager.processAuthorizationCallback({
26
- userId: this.userManager.getUserId(),
26
+ userId,
27
27
  data: response.data,
28
28
  });
29
29
  chai.assert.hasAllKeys(ids, ['credential_id', 'entity_id', 'type']);
30
30
  });
31
31
 
32
- describe('getInstance tests', async () => {
32
+ describe('getInstance tests', () => {
33
33
  it('should return a manager instance without credential or entity data', async () => {
34
34
  const userId = this.userManager.getUserId();
35
35
  const freshManager = await PipedriveManager.getInstance({
@@ -69,7 +69,7 @@ describe('Pipedrive Manager', async () => {
69
69
  });
70
70
  });
71
71
 
72
- describe('getAuthorizationRequirements tests', async () => {
72
+ describe('getAuthorizationRequirements tests', () => {
73
73
  it('should return authorization requirements of username and password', async () => {
74
74
  // Check authorization requirements
75
75
  const res = await manager.getAuthorizationRequirements();
@@ -78,18 +78,18 @@ describe('Pipedrive Manager', async () => {
78
78
  });
79
79
  });
80
80
 
81
- describe('processAuthorizationCallback tests', async () => {
81
+ describe('processAuthorizationCallback tests', () => {
82
82
  it('asserts that the original manager has a working credential', async () => {
83
83
  const res = await manager.testAuth();
84
84
  expect(res).to.be.true;
85
85
  });
86
86
  });
87
87
 
88
- describe('getEntityOptions tests', async () => {
88
+ describe('getEntityOptions tests', () => {
89
89
  // NA
90
90
  });
91
91
 
92
- describe('findOrCreateEntity tests', async () => {
92
+ describe('findOrCreateEntity tests', () => {
93
93
  it('should create a new entity for the selected profile and attach to manager', async () => {
94
94
  const userDetails = await manager.api.getUser();
95
95
  const entityRes = await manager.findOrCreateEntity({
@@ -100,7 +100,7 @@ describe('Pipedrive Manager', async () => {
100
100
  expect(entityRes.entity_id).to.exist;
101
101
  });
102
102
  });
103
- describe('testAuth tests', async () => {
103
+ describe('testAuth tests', () => {
104
104
  it('Should refresh token and update the credential with new token', async () => {
105
105
  const badAccessToken = 'smith';
106
106
  manager.api.access_token = badAccessToken;
@@ -115,7 +115,7 @@ describe('Pipedrive Manager', async () => {
115
115
  });
116
116
  });
117
117
 
118
- describe('receiveNotification tests', async () => {
118
+ describe('receiveNotification tests', () => {
119
119
  it('should fail to refresh token and mark auth as invalid', async () => {
120
120
  // Need to use a valid but old refresh token,
121
121
  // so we need to refresh first