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)
  async testShippingMethod(ctx: RequestContext, input: TestShippingMethodInput) => Promise<TestShippingMethodResult>;
  async testEligibleShippingMethods(ctx: RequestContext, input: TestEligibleShippingMethodsInput) => Promise<ShippingMethodQuote[]>;
}

Members

constructor

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

testShippingMethod

async method
type:
(ctx: RequestContext, input: TestShippingMethodInput) => Promise<TestShippingMethodResult>
Runs a given ShippingMethod configuration against a mock Order to test for eligibility and resulting price.

testEligibleShippingMethods

async method
type:
(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.