Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.

Commit

Permalink
W.I.P.
Browse files Browse the repository at this point in the history
  • Loading branch information
pierce-h committed Aug 24, 2020
1 parent 732e2da commit ea37ae4
Show file tree
Hide file tree
Showing 3 changed files with 1,295 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/core/test-app/runner/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export interface TestsConfig {
cancelShipment?: CancelShipmentConfigOptions | [CancelShipmentConfigOptions];
// createManifest?: TestOptions | [TestOptions];
createShipment_domestic?:
| CreateShipmentDomesticConfigOptions
| [CreateShipmentDomesticConfigOptions];
| CreateShipmentDomesticConfigOptions
| [CreateShipmentDomesticConfigOptions];
createShipment_international?:
| CreateShipmentInternationalConfigOptions
| [CreateShipmentInternationalConfigOptions];
| CreateShipmentInternationalConfigOptions
| [CreateShipmentInternationalConfigOptions];
createShipment_multi_package?: CreateShipmentMultiPackageConfigOptions | [CreateShipmentMultiPackageConfigOptions];
createShipment_with_insurance?: CreateShipmentWithInsuranceConfigOptions | [CreateShipmentWithInsuranceConfigOptions];
createShipment_return?: CreateShipmentReturnConfigOptions | [CreateShipmentReturnConfigOptions];
Expand Down
33 changes: 33 additions & 0 deletions src/core/test-app/runner/validate-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,31 @@ const baseTestParamValidations = {
skip: Joi.boolean().optional(),
};

const createShipmentReturnTestParamsSchema = Joi.object({
...baseTestParamValidations,
...{
rmaNumber: Joi.string().optional(),
deliveryConfirmationName: Joi.string().optional(),
deliveryServiceName: Joi.string().optional(),
shipDateTime: DateTimeZone[_internal].schema.optional(),
shipFrom: AddressWithContactInfo[_internal].schema.optional(),
shipTo: AddressWithContactInfo[_internal].schema.optional(),
weight: Weight[_internal].schema.optional(),
label: NewLabel[_internal].schema.optional(),
}
});

const cancelShipmentTestParamsSchema = Joi.object({
...baseTestParamValidations,
...{
deliveryServiceName: Joi.string().optional(),
shipDateTime: DateTimeZone[_internal].schema.optional(),
shipFrom: AddressWithContactInfo[_internal].schema.optional(),
shipTo: AddressWithContactInfo[_internal].schema.optional(),
weight: Weight[_internal].schema.optional(),
}
});

const createShipmentDomesticTestParamsSchema = Joi.object({
...baseTestParamValidations,
...{
Expand Down Expand Up @@ -97,6 +122,14 @@ const RateShipmentTestParamsSchema = Joi.object({
})

const testsSchema = Joi.object({
createShipment_return: Joi.alternatives().conditional(Joi.array(), {
then: Joi.array().items(createShipmentReturnTestParamsSchema),
otherwise: createShipmentReturnTestParamsSchema,
}),
cancelShipment: Joi.alternatives().conditional(Joi.array(), {
then: Joi.array().items(cancelShipmentTestParamsSchema),
otherwise: cancelShipmentTestParamsSchema,
}),
createShipment_domestic: Joi.alternatives().conditional(Joi.array(), {
then: Joi.array().items(createShipmentDomesticTestParamsSchema),
otherwise: createShipmentDomesticTestParamsSchema,
Expand Down
Loading

0 comments on commit ea37ae4

Please sign in to comment.