All files / test dataProvider.ts

100% Statements 19/19
100% Branches 0/0
100% Functions 1/1
100% Lines 19/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 632x             2x     2x 2x 2x 2x 2x 2x 2x                   2x 2x                                 2x 2x   2x 2x   2x       2x   2x       2x    
import {
    appInstall,
    DEFAULT_ACCESS_TOKEN,
    DEFAULT_CLIENT_ID,
    DEFAULT_CLIENT_SECRET,
    DEFAULT_USER,
} from '@orchesty/nodejs-connectors/test/DataProvider';
import {
    container, db, oauth2Provider, sender,
} from '@orchesty/nodejs-connectors/test/TestAbstract';
import CoreFormsEnum from '@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum';
import { ACCESS_TOKEN } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Provider/OAuth2/OAuth2Provider';
import { TOKEN } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/Basic/ABasicApplication';
import { CLIENT_ID, CLIENT_SECRET } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/OAuth2/IOAuth2Application';
import ZohoAddRecordsConnector from '../src/Connector/ZohoAddRecordsConnector';
import ZohoGetRecordsConnector from '../src/Connector/ZohoGetRecordsConnector';
import
ZohoApplication,
{
    ACCOUNT_OWNER_NAME,
    API_DOMAIN,
    APP_LINK_NAME,
    CREATOR_FORM, FORM_LINK_NAME,
    NAME as ZOHO_APP, REPORT_LINK_NAME,
} from '../src/ZohoApplication';
 
export default function init(): void {
    appInstall(ZOHO_APP, DEFAULT_USER, {
        [CoreFormsEnum.AUTHORIZATION_FORM]: {
            [CLIENT_ID]: DEFAULT_CLIENT_ID,
            [CLIENT_SECRET]: DEFAULT_CLIENT_SECRET,
            [TOKEN]: {
                [ACCESS_TOKEN]: DEFAULT_ACCESS_TOKEN,
                [API_DOMAIN]: 'https://creator.zoho.eu',
            },
        },
        [CREATOR_FORM]: {
            [ACCOUNT_OWNER_NAME]: 'hanaboso',
            [APP_LINK_NAME]: 'HanabosoApp',
            [FORM_LINK_NAME]: 'karel',
            [REPORT_LINK_NAME]: 'karel_Report',
        },
    });
 
    const zohoApp = new ZohoApplication(oauth2Provider);
    container.setApplication(zohoApp);
 
    const addRecords = new ZohoAddRecordsConnector();
    const getRecords = new ZohoGetRecordsConnector();
 
    addRecords
        .setSender(sender)
        .setDb(db)
        .setApplication(zohoApp);
    container.setConnector(addRecords);
 
    getRecords
        .setSender(sender)
        .setDb(db)
        .setApplication(zohoApp);
    container.setConnector(getRecords);
}