Skip to main content

OrderTestingService

OrderTestingService

This service is responsible for creating temporary mock Orders against which tests can be run, such as testing a ShippingMethod or Promotion.

Signature
class OrderTestingService {
constructor(connection: TransactionalConnection, orderCalculator: OrderCalculator, shippingCalculator: ShippingCalculator, configArgService: ConfigArgService, configService: ConfigService, productPriceApplicator: ProductPriceApplicator, translator: TranslatorService)
testShippingMethod(ctx: RequestContext, input: TestShippingMethodInput) => Promise<TestShippingMethodResult>;
testEligibleShippingMethods(ctx: RequestContext, input: TestEligibleShippingMethodsInput) => Promise<ShippingMethodQuote[]>;
}

constructor

method
(connection: TransactionalConnection, orderCalculator: OrderCalculator, shippingCalculator: ShippingCalculator, configArgService: ConfigArgService, configService: ConfigService, productPriceApplicator: ProductPriceApplicator, translator: TranslatorService) => OrderTestingService

testShippingMethod

method
(ctx: RequestContext, input: TestShippingMethodInput) => Promise<TestShippingMethodResult>

Runs a given ShippingMethod configuration against a mock Order to test for eligibility and resulting price.

testEligibleShippingMethods

method
(ctx: RequestContext, input: TestEligibleShippingMethodsInput) => Promise<ShippingMethodQuote[]>

Tests all available ShippingMethods against a mock Order and return those which are eligible. This is intended to simulate a call to the eligibleShippingMethods query of the Shop API.