I really would like to have unit tests for all my nodes,
as it helps quite a bit in different ways.
I'm having trouble understanding how to create my own flow for unit tests
especially when there is a configuration node involved... Can anyone help?
I thought something like the following would work:
- where soql-query (node) references the config node (connection-emitter),
- I would just set the property on the node to the id of the config node...
(that seems to be the case when inspecting the node when it actually loads...)
unfortunately it doesn't seem to work. Well... the load calls, but then cannot be found by helper.getNode()
I made a configuration node (connection-emitter) with the following props: host, username, password, token
and I would like to reference that configuration within another node (soql-query) with the following props: name:string, sfconn:connection-emitter, query:string and queryType:string - using inputType, target:string
This gives me an error that n1 fails the assumption - n1 should not be null
it('should load/explorer/sf-soql-query', () => {
const flow = [
{id:'n1', type:'sf-soql-query', name:'Custom_Name', sfconn:'n2'},
{id:'n2', type:'sf-connection-emitter', host:'SF_HOST', username:'SF_USERNAME', password:'SF_PASSWORD', token:'SF_TOKEN'}
];
const testPromise = new Promise((resolve, reject) => {
helper.load(soqlQueryNode, flow, () => {
try {
const n1 = helper.getNode('n1');
assert.notEqual(n1, null, 'n1 should not be null');
resolve();
} catch(err){
reject(err);
}
});
});
return testPromise;
});