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 c4d0a43 commit 23257e4
Show file tree
Hide file tree
Showing 3 changed files with 809 additions and 56 deletions.
6 changes: 3 additions & 3 deletions src/core/test-app/runner/config/rate-shipment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { BaseTestConfigOptions } from "./base-test-config-options";

export interface RateShipmentTestParams {
deliveryServiceName: string;
packagingName: string;
shipDateTime: DateTimeZonePOJO | Date | string;
shipFrom: AddressWithContactInfoPOJO;
shipTo: AddressWithContactInfoPOJO;
weight: WeightPOJO;
shipDateTime: DateTimeZonePOJO | Date | string;
packagingName: string;
}

export interface RateShipmentConfigOptions
extends RateShipmentTestParams,
BaseTestConfigOptions {}
BaseTestConfigOptions { }
41 changes: 29 additions & 12 deletions src/core/test-app/runner/validate-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
DateTimeZone,
} from "@shipengine/connect-sdk/lib/internal/common";
import { NewLabel } from "@shipengine/connect-sdk/lib/internal/carriers/documents/new-label";
import { _internal } from "@shipengine/connect-sdk/lib/internal/common/utils";
import { _internal, MonetaryValue } from "@shipengine/connect-sdk/lib/internal/common";
import { NewPackage } from "@shipengine/connect-sdk/lib/internal/carriers/packages/new-package";

const joiOptions = {
Expand All @@ -34,49 +34,66 @@ const baseTestParamValidations = {
const createShipmentDomesticTestParamsSchema = Joi.object({
...baseTestParamValidations,
...{
deliveryServiceName: Joi.string().optional(),
deliveryConfirmationName: Joi.string().optional(),
deliveryServiceName: Joi.string().optional(),
label: NewLabel[_internal].schema.optional(),
shipDateTime: DateTimeZone[_internal].schema.optional(),
shipFrom: AddressWithContactInfo[_internal].schema.optional(),
shipTo: AddressWithContactInfo[_internal].schema.optional(),
label: NewLabel[_internal].schema.optional(),
weight: Weight[_internal].schema.optional(),
shipDateTime: DateTimeZone[_internal].schema.optional(),
}
});

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

const CreateShipmentMultiPackageTestParamsSchema = Joi.object({
...baseTestParamValidations,
...{
deliveryServiceName: Joi.string().optional(),
deliveryConfirmationName: Joi.string().optional(),
deliveryServiceName: Joi.string().optional(),
packages: Joi.array().min(1).items(NewPackage[_internal].schema).optional(),
shipDateTime: DateTimeZone[_internal].schema.optional(),
shipFrom: AddressWithContactInfo[_internal].schema.optional(),
shipTo: AddressWithContactInfo[_internal].schema.optional(),
shipDateTime: DateTimeZone[_internal].schema.optional(),
packages: Joi.array().min(1).items(NewPackage[_internal].schema).optional()
}
})

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

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

const testsSchema = Joi.object({
Expand Down
Loading

0 comments on commit 23257e4

Please sign in to comment.