-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebd495c
commit 968e879
Showing
1 changed file
with
36 additions
and
38 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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
import test from 'ava'; | ||
import createRTE from '@openfn/engine-multi'; | ||
import createLogger, { createMockLogger } from '@openfn/logger'; | ||
import { createMockLogger } from '@openfn/logger'; | ||
|
||
import type { ExitReason } from '@openfn/lexicon/lightning'; | ||
|
||
|
@@ -30,13 +30,6 @@ test.before(async () => { | |
engine = await createRTE({ | ||
maxWorkers: 1, | ||
logger, | ||
// autoinstall: { | ||
// handleIsInstalled: async () => false, | ||
// handleInstall: () => | ||
// new Promise((_resolve, reject) => { | ||
// setTimeout(() => reject(new Error('not the way to amarillo')), 1); | ||
// }), | ||
// }, | ||
}); | ||
}); | ||
|
||
|
@@ -49,8 +42,8 @@ const execute = async (plan: ExecutionPlan, input = {}, options = {}) => | |
const channel = mockChannel({ | ||
[RUN_START]: async () => true, | ||
[STEP_START]: async () => true, | ||
[RUN_LOG]: async (evt) => { | ||
console.log(evt.source, evt.message) | ||
[RUN_LOG]: async (_evt) => { | ||
//console.log(evt.source, evt.message) | ||
return true | ||
}, | ||
[STEP_COMPLETE]: async () => true, | ||
|
@@ -70,33 +63,38 @@ const execute = async (plan: ExecutionPlan, input = {}, options = {}) => | |
|
||
// Repro for https://github.com/OpenFn/kit/issues/616 | ||
// This will not run in CI unless the env is set | ||
if (process.env.OPENFN_TEST_SF_TOKEN && process.env.OPENFN_TEST_SF_PASSWORD) | ||
test('salesforce issue', async (t) => { | ||
const plan = createPlan({ | ||
expression: `bulk( | ||
'Contact', | ||
'insert', | ||
{ | ||
failOnError: true, | ||
allowNoOp: true, | ||
}, | ||
state => ([{ | ||
"name": "testy mctestface", | ||
"email": "[email protected]" | ||
}]) | ||
)`, | ||
adaptor: '@openfn/[email protected]', | ||
configuration: { | ||
username: '[email protected]', | ||
securityToken: process.env.OPENFN_TEST_SF_TOKEN, | ||
password: process.env.OPENFN_TEST_SF_PASSWORD, | ||
loginUrl: 'https://login.salesforce.com', | ||
} | ||
}); | ||
if (process.env.OPENFN_TEST_SF_TOKEN && process.env.OPENFN_TEST_SF_PASSWORD) { | ||
// hard skipping the test because the insert actually fails (permissions) | ||
test.skip('salesforce issue', async (t) => { | ||
const plan = createPlan({ | ||
id: 'x', | ||
expression: `bulk( | ||
'Contact', | ||
'insert', | ||
{ | ||
failOnError: true, | ||
allowNoOp: true, | ||
}, | ||
state => ([{ | ||
"name": "testy mctestface", | ||
"email": "[email protected]" | ||
}]) | ||
)`, | ||
adaptor: '@openfn/[email protected]', | ||
configuration: { | ||
username: '[email protected]', | ||
securityToken: process.env.OPENFN_TEST_SF_TOKEN, | ||
password: process.env.OPENFN_TEST_SF_PASSWORD, | ||
loginUrl: 'https://login.salesforce.com', | ||
} | ||
}); | ||
|
||
const input = { data: { result: 42 } }; | ||
|
||
const input = { data: { result: 42 } }; | ||
const result= await execute(plan, input); | ||
t.log(result) | ||
|
||
const result= await execute(plan, input); | ||
t.log(result) | ||
t.is(result.reason.reason, 'success'); | ||
}) | ||
// Actually this fails right but it's a permissions thing on the sandbox | ||
t.is(result.reason.reason, 'success'); | ||
}) | ||
} |