All files / test dataProvider.ts

100% Statements 26/26
100% Branches 0/0
100% Functions 2/2
100% Lines 26/26

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 478x 8x 8x         8x 8x 8x 8x 8x 8x 8x 8x 8x 8x   8x 15x                           8x 8x 8x   8x 8x 8x 8x 8x 8x 8x 8x    
import { appInstall, DEFAULT_PASSWORD, DEFAULT_USER } from '@orchesty/nodejs-connectors/test/DataProvider';
import { container } from '@orchesty/nodejs-connectors/test/TestAbstract';
import CoreFormsEnum from '@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum';
import {
    ApplicationInstall,
    IApplicationSettings,
} from '@orchesty/nodejs-sdk/dist/lib/Application/Database/ApplicationInstall';
import { PASSWORD, USER } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/Basic/ABasicApplication';
import UpgatesCreateWebhooks from '../src/Batch/UpgatesCreateWebhooks';
import UpgatesGetOrders from '../src/Batch/UpgatesGetOrders';
import UpgatesGetProducts from '../src/Batch/UpgatesGetProducts';
import UpgatesDeleteWebhooks from '../src/Connector/UpgatesDeleteWebhooks';
import UpgatesGetOrderStates from '../src/Connector/UpgatesGetOrderStates';
import UpgatesGetPayments from '../src/Connector/UpgatesGetPayments';
import UpgatesGetProductParameters from '../src/Connector/UpgatesGetProductParameters';
import UpgatesGetShipments from '../src/Connector/UpgatesGetShipments';
import UpgatesApplication, { NAME, UPGATES_URL } from '../src/UpgatesApplication';
 
export function mock(extraNonEncryptedSettings?: IApplicationSettings): ApplicationInstall {
    return appInstall(
        NAME,
        DEFAULT_USER,
        {
            [CoreFormsEnum.AUTHORIZATION_FORM]: {
                [USER]: DEFAULT_USER,
                [PASSWORD]: DEFAULT_PASSWORD,
                [UPGATES_URL]: 'https://private-anon-903e641b16-upgatesapiv2.apiary-mock.com',
            },
        },
        extraNonEncryptedSettings,
    );
}
 
export function init(): void {
    const upgatesApplication = new UpgatesApplication();
    container.setApplication(upgatesApplication);
 
    container.setNode(new UpgatesCreateWebhooks(), upgatesApplication);
    container.setNode(new UpgatesDeleteWebhooks(), upgatesApplication);
    container.setNode(new UpgatesGetOrders(), upgatesApplication);
    container.setNode(new UpgatesGetProducts(), upgatesApplication);
    container.setNode(new UpgatesGetOrderStates(), upgatesApplication);
    container.setNode(new UpgatesGetShipments(), upgatesApplication);
    container.setNode(new UpgatesGetPayments(), upgatesApplication);
    container.setNode(new UpgatesGetProductParameters(), upgatesApplication);
}