cozy-harvest-lib 8.4.3 → 9.0.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/CHANGELOG.md +19 -0
- package/dist/components/KonnectorConfiguration/ConfigurationTab/index.js +5 -2
- package/dist/components/TriggerManager.js +32 -8
- package/package.json +4 -4
- package/src/components/AccountForm/index.jsx +3 -1
- package/src/components/KonnectorConfiguration/ConfigurationTab/index.jsx +3 -2
- package/src/components/NewAccountModal.spec.jsx +6 -2
- package/src/components/TriggerManager.jsx +45 -9
- package/src/models/ConnectionFlow.js +1 -1
- package/src/models/ConnectionFlow.spec.js +12 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [9.0.0](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@8.4.3...cozy-harvest-lib@9.0.0) (2022-04-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Check if we need to display the unlock form ([fe230ce](https://github.com/cozy/cozy-libs/commit/fe230ce0791c511c31098be47e633408bceb9c30))
|
|
12
|
+
* Upgrade cozy-keys-lib requirement ([c4eb57f](https://github.com/cozy/cozy-libs/commit/c4eb57f22b4a86d42c4422619a158605d894edcf))
|
|
13
|
+
* VaultClient can be undefined at first ([8a6f02b](https://github.com/cozy/cozy-libs/commit/8a6f02b9e9c161622afedff88ba4805468ee6f59))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### BREAKING CHANGES
|
|
17
|
+
|
|
18
|
+
* cozy-keys-lib >= 4.1.9 is now
|
|
19
|
+
required.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [8.4.3](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@8.4.2...cozy-harvest-lib@8.4.3) (2022-04-28)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package cozy-harvest-lib
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import cx from 'classnames';
|
|
7
7
|
import { useClient } from 'cozy-client';
|
|
8
8
|
import { Account } from 'cozy-doctypes';
|
|
9
|
-
import { useVaultClient } from 'cozy-keys-lib';
|
|
9
|
+
import { useVaultClient, CozyUtils } from 'cozy-keys-lib';
|
|
10
10
|
import Button from 'cozy-ui/transpiled/react/Button';
|
|
11
11
|
import Spinner from 'cozy-ui/transpiled/react/Spinner';
|
|
12
12
|
import palette from 'cozy-ui/transpiled/react/palette';
|
|
@@ -118,7 +118,10 @@ var ConfigurationTab = function ConfigurationTab(_ref2) {
|
|
|
118
118
|
|
|
119
119
|
showUnlockForm({
|
|
120
120
|
closable: true,
|
|
121
|
-
onUnlock: handleUnlockForDeletion
|
|
121
|
+
onUnlock: handleUnlockForDeletion,
|
|
122
|
+
addCheckShouldUnlock: function addCheckShouldUnlock() {
|
|
123
|
+
return CozyUtils.checkHasInstalledExtension(client);
|
|
124
|
+
}
|
|
122
125
|
});
|
|
123
126
|
_context.next = 8;
|
|
124
127
|
break;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
4
5
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
6
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -9,6 +10,9 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
9
10
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
10
11
|
var _excluded = ["onLaunch", "onSuccess", "onLoginSuccess", "onError", "initialTrigger"],
|
|
11
12
|
_excluded2 = ["vaultUnlockFormProps"];
|
|
13
|
+
|
|
14
|
+
var _DumbTriggerManager$p;
|
|
15
|
+
|
|
12
16
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
17
|
|
|
14
18
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
@@ -24,7 +28,7 @@ import { Account } from 'cozy-doctypes';
|
|
|
24
28
|
import { translate } from 'cozy-ui/transpiled/react/I18n';
|
|
25
29
|
import Spinner from 'cozy-ui/transpiled/react/Spinner';
|
|
26
30
|
import { ModalBackButton } from 'cozy-ui/transpiled/react/Modal';
|
|
27
|
-
import { CipherType } from 'cozy-keys-lib';
|
|
31
|
+
import { CipherType, withVaultUnlockContext, VaultUnlockPlaceholder, VaultUnlockProvider, useVaultClient, CozyUtils } from 'cozy-keys-lib';
|
|
28
32
|
import AccountForm from './AccountForm';
|
|
29
33
|
import OAuthForm from './OAuthForm';
|
|
30
34
|
import { fetchAccount } from '../connections/accounts';
|
|
@@ -34,7 +38,6 @@ import manifest from '../helpers/manifest';
|
|
|
34
38
|
import logger from '../logger';
|
|
35
39
|
import { findKonnectorPolicy } from '../konnector-policies';
|
|
36
40
|
import withConnectionFlow from '../models/withConnectionFlow';
|
|
37
|
-
import { withVaultUnlockContext, VaultUnlockPlaceholder, VaultUnlockProvider } from 'cozy-keys-lib';
|
|
38
41
|
import HarvestVaultProvider from './HarvestVaultProvider';
|
|
39
42
|
var IDLE = 'IDLE';
|
|
40
43
|
var RUNNING = 'RUNNING';
|
|
@@ -301,13 +304,13 @@ export var DumbTriggerManager = /*#__PURE__*/function (_Component) {
|
|
|
301
304
|
key: "componentDidMount",
|
|
302
305
|
value: function () {
|
|
303
306
|
var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
304
|
-
var _this$props3, konnector, showUnlockForm, onVaultDismiss, vaultClosable, vaultClient, konnectorPolicy, isVaultLocked;
|
|
307
|
+
var _this$props3, konnector, showUnlockForm, onVaultDismiss, vaultClosable, vaultClient, client, konnectorPolicy, isVaultLocked;
|
|
305
308
|
|
|
306
309
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
307
310
|
while (1) {
|
|
308
311
|
switch (_context3.prev = _context3.next) {
|
|
309
312
|
case 0:
|
|
310
|
-
_this$props3 = this.props, konnector = _this$props3.konnector, showUnlockForm = _this$props3.showUnlockForm, onVaultDismiss = _this$props3.onVaultDismiss, vaultClosable = _this$props3.vaultClosable, vaultClient = _this$props3.vaultClient;
|
|
313
|
+
_this$props3 = this.props, konnector = _this$props3.konnector, showUnlockForm = _this$props3.showUnlockForm, onVaultDismiss = _this$props3.onVaultDismiss, vaultClosable = _this$props3.vaultClosable, vaultClient = _this$props3.vaultClient, client = _this$props3.client;
|
|
311
314
|
konnectorPolicy = findKonnectorPolicy(konnector);
|
|
312
315
|
|
|
313
316
|
if (!konnectorPolicy.saveInVault) {
|
|
@@ -333,7 +336,10 @@ export var DumbTriggerManager = /*#__PURE__*/function (_Component) {
|
|
|
333
336
|
showUnlockForm({
|
|
334
337
|
onDismiss: onVaultDismiss,
|
|
335
338
|
closable: vaultClosable,
|
|
336
|
-
onUnlock: this.handleVaultUnlock
|
|
339
|
+
onUnlock: this.handleVaultUnlock,
|
|
340
|
+
addCheckShouldUnlock: function addCheckShouldUnlock() {
|
|
341
|
+
return CozyUtils.checkHasInstalledExtension(client);
|
|
342
|
+
}
|
|
337
343
|
});
|
|
338
344
|
} else {
|
|
339
345
|
this.handleVaultUnlock();
|
|
@@ -561,7 +567,7 @@ export var DumbTriggerManager = /*#__PURE__*/function (_Component) {
|
|
|
561
567
|
|
|
562
568
|
return DumbTriggerManager;
|
|
563
569
|
}(Component);
|
|
564
|
-
DumbTriggerManager.propTypes = {
|
|
570
|
+
DumbTriggerManager.propTypes = (_DumbTriggerManager$p = {
|
|
565
571
|
/**
|
|
566
572
|
* Account document. Used to get initial form values.
|
|
567
573
|
* If no account is passed, AccountForm will use empty initial values.
|
|
@@ -594,11 +600,29 @@ DumbTriggerManager.propTypes = {
|
|
|
594
600
|
* Whether the vault will be closable or not.
|
|
595
601
|
* @type {Boolean}
|
|
596
602
|
*/
|
|
597
|
-
vaultClosable: PropTypes.bool
|
|
598
|
-
|
|
603
|
+
vaultClosable: PropTypes.bool,
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
*
|
|
607
|
+
*/
|
|
608
|
+
vaultClient: PropTypes.object,
|
|
609
|
+
client: PropTypes.object,
|
|
610
|
+
onError: PropTypes.func,
|
|
611
|
+
showUnlockForm: PropTypes.func
|
|
612
|
+
}, _defineProperty(_DumbTriggerManager$p, "onVaultDismiss", PropTypes.func), _defineProperty(_DumbTriggerManager$p, "error", PropTypes.any), _defineProperty(_DumbTriggerManager$p, "showError", PropTypes.bool), _defineProperty(_DumbTriggerManager$p, "fieldOptions", PropTypes.object), _defineProperty(_DumbTriggerManager$p, "flow", PropTypes.object), _defineProperty(_DumbTriggerManager$p, "flowState", PropTypes.object), _DumbTriggerManager$p);
|
|
599
613
|
var TriggerManager = compose(translate(), withClient, withVaultUnlockContext, withConnectionFlow())(DumbTriggerManager); // TriggerManager is exported wrapped in FlowProvider to avoid breaking changes.
|
|
600
614
|
|
|
601
615
|
var LegacyTriggerManager = function LegacyTriggerManager(props) {
|
|
616
|
+
// Since the 4.1.0 of cozy-keys-lib, we
|
|
617
|
+
// render children even if vaultClient is
|
|
618
|
+
// not defined yet. In that case we we were
|
|
619
|
+
// displaying TriggerManager without vaultClient.
|
|
620
|
+
// It was raising an error.
|
|
621
|
+
// The current fix, is to not display the
|
|
622
|
+
// TriggerManager when vaultClient is null.
|
|
623
|
+
var vaultClient = useVaultClient();
|
|
624
|
+
if (!vaultClient) return null;
|
|
625
|
+
|
|
602
626
|
var onLaunch = props.onLaunch,
|
|
603
627
|
onSuccess = props.onSuccess,
|
|
604
628
|
onLoginSuccess = props.onLoginSuccess,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-harvest-lib",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "Provides logic, modules and components for Cozy's harvest applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"cozy-client": "27.17.0",
|
|
56
56
|
"cozy-device-helper": "^2.0.0",
|
|
57
57
|
"cozy-flags": "^2.8.7",
|
|
58
|
-
"cozy-keys-lib": "
|
|
58
|
+
"cozy-keys-lib": "^4.1.9",
|
|
59
59
|
"cozy-realtime": "^4.0.8",
|
|
60
60
|
"cozy-ui": "60.6.0",
|
|
61
61
|
"enzyme": "3.11.0",
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
"cozy-client": ">=27.17.0",
|
|
79
79
|
"cozy-device-helper": ">=1.10.2",
|
|
80
80
|
"cozy-flags": ">=2.3.5",
|
|
81
|
-
"cozy-keys-lib": ">=
|
|
81
|
+
"cozy-keys-lib": ">=4.1.9",
|
|
82
82
|
"cozy-realtime": ">=3.12.2",
|
|
83
83
|
"cozy-ui": ">=60.6.0",
|
|
84
84
|
"leaflet": "^1.7.1",
|
|
85
85
|
"react-router-dom": "^5.0.1"
|
|
86
86
|
},
|
|
87
87
|
"sideEffects": false,
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "45955517b20ac0da6a5df0add16a84024eccf791"
|
|
89
89
|
}
|
|
@@ -132,7 +132,9 @@ export class AccountForm extends PureComponent {
|
|
|
132
132
|
handleSubmit(values, form) {
|
|
133
133
|
const { account, konnector } = this.props
|
|
134
134
|
|
|
135
|
-
const identifier = manifest.getIdentifier(
|
|
135
|
+
const identifier = manifest.getIdentifier(
|
|
136
|
+
manifest.sanitizeFields(konnector.fields)
|
|
137
|
+
)
|
|
136
138
|
if (
|
|
137
139
|
account &&
|
|
138
140
|
account.auth[identifier] &&
|
|
@@ -4,7 +4,7 @@ import cx from 'classnames'
|
|
|
4
4
|
|
|
5
5
|
import { useClient } from 'cozy-client'
|
|
6
6
|
import { Account } from 'cozy-doctypes'
|
|
7
|
-
import { useVaultClient } from 'cozy-keys-lib'
|
|
7
|
+
import { useVaultClient, CozyUtils } from 'cozy-keys-lib'
|
|
8
8
|
|
|
9
9
|
import Button from 'cozy-ui/transpiled/react/Button'
|
|
10
10
|
import Spinner from 'cozy-ui/transpiled/react/Spinner'
|
|
@@ -96,7 +96,8 @@ const ConfigurationTab = ({
|
|
|
96
96
|
if (konnectorPolicy.saveInVault) {
|
|
97
97
|
showUnlockForm({
|
|
98
98
|
closable: true,
|
|
99
|
-
onUnlock: handleUnlockForDeletion
|
|
99
|
+
onUnlock: handleUnlockForDeletion,
|
|
100
|
+
addCheckShouldUnlock: () => CozyUtils.checkHasInstalledExtension(client)
|
|
100
101
|
})
|
|
101
102
|
} else {
|
|
102
103
|
await handleDeleteAccount()
|
|
@@ -58,7 +58,9 @@ describe('NewAccountModal', () => {
|
|
|
58
58
|
</AppLike>
|
|
59
59
|
)
|
|
60
60
|
onLoginSuccessFn(konnectorTrigger)
|
|
61
|
-
expect(replaceHistory).toHaveBeenCalledWith(
|
|
61
|
+
expect(replaceHistory).toHaveBeenCalledWith(
|
|
62
|
+
'/accounts/accountNumber/success'
|
|
63
|
+
)
|
|
62
64
|
})
|
|
63
65
|
it('should redirect to route without success on login success for client triggers', () => {
|
|
64
66
|
render(
|
|
@@ -85,7 +87,9 @@ describe('NewAccountModal', () => {
|
|
|
85
87
|
</AppLike>
|
|
86
88
|
)
|
|
87
89
|
onSuccessFn(konnectorTrigger)
|
|
88
|
-
expect(replaceHistory).toHaveBeenCalledWith(
|
|
90
|
+
expect(replaceHistory).toHaveBeenCalledWith(
|
|
91
|
+
'/accounts/accountNumber/success'
|
|
92
|
+
)
|
|
89
93
|
})
|
|
90
94
|
it('should redirect to route without success on success for client triggers', () => {
|
|
91
95
|
render(
|
|
@@ -10,7 +10,14 @@ import { translate } from 'cozy-ui/transpiled/react/I18n'
|
|
|
10
10
|
import Spinner from 'cozy-ui/transpiled/react/Spinner'
|
|
11
11
|
import { ModalBackButton } from 'cozy-ui/transpiled/react/Modal'
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
CipherType,
|
|
15
|
+
withVaultUnlockContext,
|
|
16
|
+
VaultUnlockPlaceholder,
|
|
17
|
+
VaultUnlockProvider,
|
|
18
|
+
useVaultClient,
|
|
19
|
+
CozyUtils
|
|
20
|
+
} from 'cozy-keys-lib'
|
|
14
21
|
|
|
15
22
|
import AccountForm from './AccountForm'
|
|
16
23
|
import OAuthForm from './OAuthForm'
|
|
@@ -21,11 +28,6 @@ import manifest from '../helpers/manifest'
|
|
|
21
28
|
import logger from '../logger'
|
|
22
29
|
import { findKonnectorPolicy } from '../konnector-policies'
|
|
23
30
|
import withConnectionFlow from '../models/withConnectionFlow'
|
|
24
|
-
import {
|
|
25
|
-
withVaultUnlockContext,
|
|
26
|
-
VaultUnlockPlaceholder,
|
|
27
|
-
VaultUnlockProvider
|
|
28
|
-
} from 'cozy-keys-lib'
|
|
29
31
|
import HarvestVaultProvider from './HarvestVaultProvider'
|
|
30
32
|
|
|
31
33
|
const IDLE = 'IDLE'
|
|
@@ -210,7 +212,8 @@ export class DumbTriggerManager extends Component {
|
|
|
210
212
|
showUnlockForm,
|
|
211
213
|
onVaultDismiss,
|
|
212
214
|
vaultClosable,
|
|
213
|
-
vaultClient
|
|
215
|
+
vaultClient,
|
|
216
|
+
client
|
|
214
217
|
} = this.props
|
|
215
218
|
const konnectorPolicy = findKonnectorPolicy(konnector)
|
|
216
219
|
if (konnectorPolicy.saveInVault) {
|
|
@@ -224,7 +227,9 @@ export class DumbTriggerManager extends Component {
|
|
|
224
227
|
showUnlockForm({
|
|
225
228
|
onDismiss: onVaultDismiss,
|
|
226
229
|
closable: vaultClosable,
|
|
227
|
-
onUnlock: this.handleVaultUnlock
|
|
230
|
+
onUnlock: this.handleVaultUnlock,
|
|
231
|
+
addCheckShouldUnlock: () =>
|
|
232
|
+
CozyUtils.checkHasInstalledExtension(client)
|
|
228
233
|
})
|
|
229
234
|
} else {
|
|
230
235
|
this.handleVaultUnlock()
|
|
@@ -410,7 +415,29 @@ DumbTriggerManager.propTypes = {
|
|
|
410
415
|
* Whether the vault will be closable or not.
|
|
411
416
|
* @type {Boolean}
|
|
412
417
|
*/
|
|
413
|
-
vaultClosable: PropTypes.bool
|
|
418
|
+
vaultClosable: PropTypes.bool,
|
|
419
|
+
/**
|
|
420
|
+
*
|
|
421
|
+
*/
|
|
422
|
+
vaultClient: PropTypes.object,
|
|
423
|
+
client: PropTypes.object,
|
|
424
|
+
onError: PropTypes.func,
|
|
425
|
+
showUnlockForm: PropTypes.func,
|
|
426
|
+
onVaultDismiss: PropTypes.func,
|
|
427
|
+
error: PropTypes.any,
|
|
428
|
+
/**
|
|
429
|
+
* Indicates if the AccountForm has to show errors. Sometimes errors may be
|
|
430
|
+
* displayed elsewhere. However, a KonnectorJobError corresponding to a login
|
|
431
|
+
* error is always displayed.
|
|
432
|
+
* @type {Boolean}
|
|
433
|
+
*/
|
|
434
|
+
showError: PropTypes.bool,
|
|
435
|
+
/**
|
|
436
|
+
* Used to have options on fields (forceEncryptedPlaceholder or focus)
|
|
437
|
+
*/
|
|
438
|
+
fieldOptions: PropTypes.object,
|
|
439
|
+
flow: PropTypes.object,
|
|
440
|
+
flowState: PropTypes.object
|
|
414
441
|
}
|
|
415
442
|
|
|
416
443
|
const TriggerManager = compose(
|
|
@@ -422,6 +449,15 @@ const TriggerManager = compose(
|
|
|
422
449
|
|
|
423
450
|
// TriggerManager is exported wrapped in FlowProvider to avoid breaking changes.
|
|
424
451
|
const LegacyTriggerManager = props => {
|
|
452
|
+
// Since the 4.1.0 of cozy-keys-lib, we
|
|
453
|
+
// render children even if vaultClient is
|
|
454
|
+
// not defined yet. In that case we we were
|
|
455
|
+
// displaying TriggerManager without vaultClient.
|
|
456
|
+
// It was raising an error.
|
|
457
|
+
// The current fix, is to not display the
|
|
458
|
+
// TriggerManager when vaultClient is null.
|
|
459
|
+
const vaultClient = useVaultClient()
|
|
460
|
+
if (!vaultClient) return null
|
|
425
461
|
const {
|
|
426
462
|
onLaunch,
|
|
427
463
|
onSuccess,
|
|
@@ -8,7 +8,9 @@ import {
|
|
|
8
8
|
launchTrigger
|
|
9
9
|
} from '../connections/triggers'
|
|
10
10
|
import CozyRealtime from 'cozy-realtime'
|
|
11
|
-
import KonnectorJobWatcher, {
|
|
11
|
+
import KonnectorJobWatcher, {
|
|
12
|
+
watchKonnectorJob
|
|
13
|
+
} from './konnector/KonnectorJobWatcher'
|
|
12
14
|
import { konnectorPolicy as biKonnectorPolicy } from '../services/budget-insight'
|
|
13
15
|
import fixtures from '../../test/fixtures'
|
|
14
16
|
import sentryHub from '../sentry'
|
|
@@ -118,14 +120,13 @@ describe('ConnectionFlow', () => {
|
|
|
118
120
|
return flow.getState().running === true
|
|
119
121
|
}
|
|
120
122
|
beforeAll(() => {
|
|
121
|
-
watchKonnectorJob.mockReturnValue({on: () => ({})})
|
|
123
|
+
watchKonnectorJob.mockReturnValue({ on: () => ({}) })
|
|
122
124
|
})
|
|
123
125
|
|
|
124
126
|
afterEach(() => {
|
|
125
127
|
jest.clearAllMocks()
|
|
126
128
|
})
|
|
127
129
|
|
|
128
|
-
|
|
129
130
|
it('should render as submitting when there is no account', async () => {
|
|
130
131
|
const { flow } = setup()
|
|
131
132
|
const submitPromise = setupSubmit(flow)
|
|
@@ -327,7 +328,7 @@ describe('ConnectionFlow', () => {
|
|
|
327
328
|
describe('ensureTriggerAndLaunch', () => {
|
|
328
329
|
beforeAll(() => {
|
|
329
330
|
jest.spyOn(cronHelpers, 'fromFrequency').mockReturnValue('0 0 0 * * 0')
|
|
330
|
-
watchKonnectorJob.mockReturnValue({on: () => ({})})
|
|
331
|
+
watchKonnectorJob.mockReturnValue({ on: () => ({}) })
|
|
331
332
|
})
|
|
332
333
|
|
|
333
334
|
afterEach(() => {
|
|
@@ -494,7 +495,7 @@ describe('ConnectionFlow', () => {
|
|
|
494
495
|
|
|
495
496
|
describe('constructor', () => {
|
|
496
497
|
beforeAll(() => {
|
|
497
|
-
watchKonnectorJob.mockReturnValue({on: () => ({})})
|
|
498
|
+
watchKonnectorJob.mockReturnValue({ on: () => ({}) })
|
|
498
499
|
})
|
|
499
500
|
|
|
500
501
|
afterEach(() => {
|
|
@@ -502,8 +503,12 @@ describe('ConnectionFlow', () => {
|
|
|
502
503
|
})
|
|
503
504
|
|
|
504
505
|
it('should watch a running trigger', () => {
|
|
505
|
-
setup({trigger: fixtures.runningTrigger})
|
|
506
|
-
expect(watchKonnectorJob).toHaveBeenCalledWith(
|
|
506
|
+
setup({ trigger: fixtures.runningTrigger })
|
|
507
|
+
expect(watchKonnectorJob).toHaveBeenCalledWith(
|
|
508
|
+
expect.any(Object),
|
|
509
|
+
{ _id: 'runningjobid' },
|
|
510
|
+
{ autoSuccessTimer: false }
|
|
511
|
+
)
|
|
507
512
|
})
|
|
508
513
|
})
|
|
509
514
|
})
|