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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 18x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x | import { appInstall, DEFAULT_CLIENT_ID, DEFAULT_CLIENT_SECRET, DEFAULT_USER } from '@orchesty/nodejs-connectors/test/DataProvider';
import { cacheService, container } from '@orchesty/nodejs-connectors/test/TestAbstract';
import CoreFormsEnum from '@orchesty/nodejs-sdk/dist/lib/Application/Base/CoreFormsEnum';
import { ApplicationInstall } from '@orchesty/nodejs-sdk/dist/lib/Application/Database/ApplicationInstall';
import { CLIENT_ID, CLIENT_SECRET } from '@orchesty/nodejs-sdk/dist/lib/Authorization/Type/OAuth2/IOAuth2Application';
import Redis from '@orchesty/nodejs-sdk/dist/lib/Storage/Redis/Redis';
import AuthenticaApplication, {
NAME as AUTHENTICA,
} from '../src/AuthenticaApplication';
import AuthenticaGetStock from '../src/Batch/AuthenticaGetStock';
import AuthenticaGetStockAvailable from '../src/Batch/AuthenticaGetStockAvailable';
import AuthenticaCreateOrder from '../src/Connector/AuthenticaCreateOrder';
import AuthenticaCreateProduct from '../src/Connector/AuthenticaCreateProduct';
import AuthenticaCreateReceipt from '../src/Connector/AuthenticaCreateReceipt';
import { AuthenticaGetCarriers } from '../src/Connector/AuthenticaGetCarriersConnector';
import AuthenticaGetOrder from '../src/Connector/AuthenticaGetOrder';
import AuthenticaGetOrderStatus from '../src/Connector/AuthenticaGetOrderStatus';
import AuthenticaGetReceipt from '../src/Connector/AuthenticaGetReceipt';
import AuthenticaGetShippingMethods from '../src/Connector/AuthenticaGetShippingMethods';
import AuthenticaPostLabel from '../src/Connector/AuthenticaPostLabel';
import AuthenticaPutOrders from '../src/Connector/AuthenticaPutOrders';
import AuthenticaPostProducts from '../src/Connector/AuthenticaPutProducts';
import AuthenticaUpdateOrder from '../src/Connector/AuthenticaUpdateOrder';
import AuthenticaUpdateProduct from '../src/Connector/AuthenticaUpdateProduct';
import AuthenticaUpdateReceipt from '../src/Connector/AuthenticaUpdateReceipt';
export function mock(): ApplicationInstall {
return appInstall(
AUTHENTICA,
DEFAULT_USER,
{
[CoreFormsEnum.AUTHORIZATION_FORM]: {
[CLIENT_ID]: DEFAULT_CLIENT_ID,
[CLIENT_SECRET]: DEFAULT_CLIENT_SECRET,
},
},
);
}
export async function regiterApiKey(): Promise<void> {
const redis = container.get(Redis);
await redis.remove('authentica_cache_key');
await redis.set(
'authentica_cache_key',
JSON.stringify({
expiration: 1759965308,
access_token: 'testAccessToken',
refresh_token: 'testRefreshToken',
refresh_token_expiration: 1759965308,
}),
4,
);
}
export async function initAuthenticaTest(): Promise<void> {
mock();
await regiterApiKey();
const authenticaApplication = new AuthenticaApplication(cacheService);
container.setApplication(authenticaApplication);
container.setNode(new AuthenticaGetShippingMethods(), authenticaApplication);
container.setNode(new AuthenticaPutOrders(), authenticaApplication);
container.setNode(new AuthenticaPostProducts(), authenticaApplication);
container.setNode(new AuthenticaGetOrderStatus(), authenticaApplication);
container.setNode(new AuthenticaGetStock(), authenticaApplication);
container.setNode(new AuthenticaGetStockAvailable(), authenticaApplication);
container.setNode(new AuthenticaGetCarriers(), authenticaApplication);
container.setNode(new AuthenticaGetOrder(), authenticaApplication);
container.setNode(new AuthenticaGetReceipt(), authenticaApplication);
container.setNode(new AuthenticaCreateProduct(), authenticaApplication);
container.setNode(new AuthenticaUpdateProduct('product'), authenticaApplication);
container.setNode(new AuthenticaCreateOrder(), authenticaApplication);
container.setNode(new AuthenticaUpdateOrder(), authenticaApplication);
container.setNode(new AuthenticaCreateReceipt(), authenticaApplication);
container.setNode(new AuthenticaUpdateReceipt(), authenticaApplication);
container.setNode(new AuthenticaPostLabel(), authenticaApplication);
}
|