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

Commit

Permalink
rename schedule pickups to be consistent with the other acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrauskopf committed Oct 14, 2020
1 parent 9a377ff commit d6e251a
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 55 deletions.
6 changes: 3 additions & 3 deletions src/core/test-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import {
CancelShipmentsSingle,
CancelShipmentsMultiple,
CancelPickupsSameDay,
SameDayPickup,
NextDayPickup,
SchedulePickupSameDay,
SchedulePickupNextDay,
RateShipmentReturn,
} from "./test-app/tests";

Expand Down Expand Up @@ -167,7 +167,7 @@ function registerTestSuiteModules(app: SdkApp): RegisteredTestSuiteModules {
CreateShipmentReturn
],
cancelPickups: [CancelPickupsSameDay, CancelPickupsNextDay],
schedulePickup: [SameDayPickup, NextDayPickup],
schedulePickup: [SchedulePickupSameDay, SchedulePickupNextDay],
rateShipment: [
RateShipment,
RateShipmentWithAllServices,
Expand Down
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 @@ -10,9 +10,9 @@ import { RateShipmentWithAllServicesConfigOptions } from './config/rate-shipment
import { CancelShipmentsSingleConfigOptions } from './config/cancel-shipments-single';
import { CancelShipmentsMultipleConfigOptions } from './config/cancel-shipments-multiple';
import { CreateShipmentReturnConfigOptions } from './config/create-shipment-return';
import { SameDayPickupConfigOptions } from './config/same-day-pickup';
import { SchedulePickupSameDayConfigOptions } from './config/schedule-pickup-same-day';
import { RateShipmentReturnConfigOptions } from './config/rate-shipment-return';
import { NextDayPickupConfigOptions } from './config/next-day-pickup';
import { SchedulePickupNextDayConfigOptions } from './config/schedule-pickup-next-day';
import { TrackShipmentConfigOptions } from './config/track-shipment';
import { TrackShipmentReturnConfigOptions } from './config/track-shipment-return';
import { CancelPickupsSameDayConfigOptions } from './config/cancel-pickups-same-day';
Expand All @@ -33,8 +33,8 @@ export interface TestsConfig {
rateShipment?: RateShipmentConfigOptions | [RateShipmentConfigOptions];
rateShipment_with_all_services?: RateShipmentWithAllServicesConfigOptions | [RateShipmentWithAllServicesConfigOptions];
rateShipment_return?: RateShipmentReturnConfigOptions | [RateShipmentReturnConfigOptions];
schedulePickup_same_day?: SameDayPickupConfigOptions | [SameDayPickupConfigOptions];
schedulePickup_next_day?: NextDayPickupConfigOptions | [NextDayPickupConfigOptions];
schedulePickup_same_day?: SchedulePickupSameDayConfigOptions | [SchedulePickupSameDayConfigOptions];
schedulePickup_next_day?: SchedulePickupNextDayConfigOptions | [SchedulePickupNextDayConfigOptions];
trackShipment?: TrackShipmentConfigOptions | [TrackShipmentConfigOptions];
trackReturnShipment?: TrackShipmentReturnConfigOptions | [TrackShipmentReturnConfigOptions];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type PickupShipmentConfig = {
packages: PickupPackageConfig[];
};

export interface NextDayPickupTestParams {
export interface SchedulePickupNextDayTestParams {
pickupServiceName: string;
deliveryServiceName: string;
address: AddressPOJO;
Expand All @@ -28,6 +28,6 @@ export interface NextDayPickupTestParams {
shipments: PickupShipmentConfig[];
}

export interface NextDayPickupConfigOptions
extends NextDayPickupTestParams,
export interface SchedulePickupNextDayConfigOptions
extends SchedulePickupNextDayTestParams,
BaseTestConfigOptions {}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type PickupShipmentConfig = {
packages: PickupPackageConfig[];
};

export interface SameDayPickupTestParams {
export interface SchedulePickupSameDayTestParams {
pickupServiceName: string;
deliveryServiceName: string;
address: AddressPOJO;
Expand All @@ -28,6 +28,6 @@ export interface SameDayPickupTestParams {
shipments: PickupShipmentConfig[];
}

export interface SameDayPickupConfigOptions
extends SameDayPickupTestParams,
export interface SchedulePickupSameDayConfigOptions
extends SchedulePickupSameDayTestParams,
BaseTestConfigOptions {}
4 changes: 2 additions & 2 deletions src/core/test-app/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export * from "./create-shipment-international";
export * from "./create-shipment-multipackage";
export * from "./create-shipment-return";
export * from "./create-shipment-with-insurance";
export * from "./next-day-pickup";
export * from "./schedule-pickup-next-day";
export * from "./rate-shipment";
export * from "./rate-shipment-with-all-services";
export * from "./track-shipment";
export * from "./track-shipment-return"
export * from "./same-day-pickup";
export * from "./schedule-pickup-same-day";
export * from "./cancel-pickups-same-day";
export * from "./rate-shipment-return";
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DeliveryService, PickupService, LengthUnit, WeightUnit } from "@shipeng
import { CarrierApp, PickupRequestPOJO, PickupShipmentPOJO, PickupPackagePOJO } from "@shipengine/connect-sdk/lib/internal";
import Suite from "../runner/suite";
import { initializeTimeStamps } from "../../utils/time-stamps";
import { NextDayPickupTestParams, NextDayPickupConfigOptions } from "../runner/config/next-day-pickup";
import { SchedulePickupNextDayTestParams, SchedulePickupNextDayConfigOptions } from "../runner/config/schedule-pickup-next-day";
import reduceDefaultsWithConfig from "../utils/reduce-defaults-with-config";
import objectToTestTitle from "../utils/object-to-test-title";
import useShipmentAddresses from '../utils/use-shipment-addresses';
Expand All @@ -17,18 +17,18 @@ interface TestArgs {
title: string;
methodArgs: PickupRequestPOJO;
config: unknown;
testParams: NextDayPickupTestParams;
testParams: SchedulePickupNextDayTestParams;
}

export class NextDayPickup extends Suite {
export class SchedulePickupNextDay extends Suite {
title = "schedulePickup_next_day";

private deliveryService: DeliveryService | undefined;

private pickupService: PickupService | undefined;

private setDeliveryService(
config: NextDayPickupConfigOptions,
config: SchedulePickupNextDayConfigOptions,
): void {
const carrierApp = this.app as CarrierApp;

Expand All @@ -46,7 +46,7 @@ export class NextDayPickup extends Suite {
}
}

private setPickupService(config: NextDayPickupConfigOptions): void {
private setPickupService(config: SchedulePickupNextDayConfigOptions): void {
const carrierApp = this.app as CarrierApp;

if (config.pickupServiceName) {
Expand All @@ -58,7 +58,7 @@ export class NextDayPickup extends Suite {
}
}

buildTestArg(config: NextDayPickupConfigOptions): TestArgs | undefined {
buildTestArg(config: SchedulePickupNextDayConfigOptions): TestArgs | undefined {
const carrierApp = this.app as CarrierApp;
this.setPickupService(config);
this.setDeliveryService(config);
Expand All @@ -72,7 +72,7 @@ export class NextDayPickup extends Suite {

const { tomorrowEarlyAM, tomorrowEvening } = initializeTimeStamps();

const defaults: NextDayPickupTestParams = {
const defaults: SchedulePickupNextDayTestParams = {
pickupServiceName: this.pickupService.name,
deliveryServiceName: this.deliveryService.name,
address,
Expand Down Expand Up @@ -102,7 +102,7 @@ export class NextDayPickup extends Suite {
};

const testParams = reduceDefaultsWithConfig<
NextDayPickupTestParams
SchedulePickupNextDayTestParams
>(defaults, config);

const shipments: PickupShipmentPOJO[] = testParams.shipments.map((shipmentParams) => {
Expand Down Expand Up @@ -148,12 +148,12 @@ export class NextDayPickup extends Suite {

buildTestArgs(): Array<TestArgs | undefined> {
if (Array.isArray(this.config)) {
return this.config.map((config: NextDayPickupConfigOptions) => {
return this.config.map((config: SchedulePickupNextDayConfigOptions) => {
return this.buildTestArg(config);
});
}

const config = this.config as NextDayPickupConfigOptions;
const config = this.config as SchedulePickupNextDayConfigOptions;
return [this.buildTestArg(config)];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { DeliveryService, PickupService, LengthUnit, WeightUnit } from "@shipeng
import { CarrierApp, PickupRequestPOJO, PickupShipmentPOJO, PickupPackagePOJO } from "@shipengine/connect-sdk/lib/internal";
import Suite from "../runner/suite";
import { initializeTimeStamps } from "../../utils/time-stamps";
import { SameDayPickupTestParams, SameDayPickupConfigOptions } from "../runner/config/same-day-pickup";
import { SchedulePickupSameDayTestParams, SchedulePickupSameDayConfigOptions } from "../runner/config/schedule-pickup-same-day";
import reduceDefaultsWithConfig from "../utils/reduce-defaults-with-config";
import objectToTestTitle from "../utils/object-to-test-title";
import useShipmentAddresses from '../utils/use-shipment-addresses';
Expand All @@ -17,18 +17,18 @@ interface TestArgs {
title: string;
methodArgs: PickupRequestPOJO;
config: unknown;
testParams: SameDayPickupTestParams;
testParams: SchedulePickupSameDayTestParams;
}

export class SameDayPickup extends Suite {
export class SchedulePickupSameDay extends Suite {
title = "schedulePickup_same_day";

private deliveryService: DeliveryService | undefined;

private pickupService: PickupService | undefined;

private setDeliveryService(
config: SameDayPickupConfigOptions,
config: SchedulePickupSameDayConfigOptions,
): void {
const carrierApp = this.app as CarrierApp;

Expand All @@ -46,7 +46,7 @@ export class SameDayPickup extends Suite {
}
}

private setPickupService(config: SameDayPickupConfigOptions): void {
private setPickupService(config: SchedulePickupSameDayConfigOptions): void {
const carrierApp = this.app as CarrierApp;

if (config.pickupServiceName) {
Expand All @@ -58,7 +58,7 @@ export class SameDayPickup extends Suite {
}
}

buildTestArg(config: SameDayPickupConfigOptions): TestArgs | undefined {
buildTestArg(config: SchedulePickupSameDayConfigOptions): TestArgs | undefined {
const carrierApp = this.app as CarrierApp;
this.setPickupService(config);
this.setDeliveryService(config);
Expand All @@ -72,7 +72,7 @@ export class SameDayPickup extends Suite {

const { todayEarly, todayEvening } = initializeTimeStamps();

const defaults: SameDayPickupTestParams = {
const defaults: SchedulePickupSameDayTestParams = {
pickupServiceName: this.pickupService.name,
deliveryServiceName: this.deliveryService.name,
address,
Expand Down Expand Up @@ -102,7 +102,7 @@ export class SameDayPickup extends Suite {
};

const testParams = reduceDefaultsWithConfig<
SameDayPickupTestParams
SchedulePickupSameDayTestParams
>(defaults, config);

const shipments: PickupShipmentPOJO[] = testParams.shipments.map((shipmentParams) => {
Expand Down Expand Up @@ -150,12 +150,12 @@ export class SameDayPickup extends Suite {

buildTestArgs(): Array<TestArgs | undefined> {
if (Array.isArray(this.config)) {
return this.config.map((config: SameDayPickupConfigOptions) => {
return this.config.map((config: SchedulePickupSameDayConfigOptions) => {
return this.buildTestArg(config);
});
}

const config = this.config as SameDayPickupConfigOptions;
const config = this.config as SchedulePickupSameDayConfigOptions;
return [this.buildTestArg(config)];
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable camelcase */
"use strict";

const { NextDayPickup } = require("../../../../../lib/core/test-app/tests/next-day-pickup");
const { SchedulePickupNextDay } = require("../../../../../lib/core/test-app/tests/schedule-pickup-next-day");
const { CarrierApp } = require("@shipengine/connect-sdk/lib/internal/carriers/carrier-app");
const pojo = require("../../../../utils/pojo");
const { expect } = require("chai");
Expand All @@ -16,7 +16,7 @@ describe("The schedule next day pickup test suite", () => {

const app = new CarrierApp(appDefinition);
const args = { app, connectArgs, staticConfigTests, options };
const testSuite = new NextDayPickup(args);
const testSuite = new SchedulePickupNextDay(args);

const tests = testSuite.tests();
expect(tests.length).to.equal(0);
Expand All @@ -31,7 +31,7 @@ describe("The schedule next day pickup test suite", () => {
const app = new CarrierApp(appDefinition);
const args = { app, connectArgs, staticConfigTests, options };

testSuite = new NextDayPickup(args);
testSuite = new SchedulePickupNextDay(args);
});

it("should generate a test", () => {
Expand Down Expand Up @@ -78,7 +78,7 @@ describe("The schedule next day pickup test suite", () => {
};

const args = { app, connectArgs, staticConfigTests, options };
const testSuite = new NextDayPickup(args);
const testSuite = new SchedulePickupNextDay(args);
const tests = testSuite.tests();

expect(tests[0].title).to.include("contact: Jane Doe");
Expand All @@ -103,7 +103,7 @@ describe("The schedule next day pickup test suite", () => {
];

const args = { app, connectArgs, staticConfigTests, options };
const testSuite = new NextDayPickup(args);
const testSuite = new SchedulePickupNextDay(args);
tests = testSuite.tests();
});

Expand Down Expand Up @@ -132,7 +132,7 @@ describe("The schedule next day pickup test suite", () => {
};

const args = { app, connectArgs, staticConfigTests, options };
const testSuite = new NextDayPickup(args);
const testSuite = new SchedulePickupNextDay(args);

try {
testSuite.tests();
Expand All @@ -153,7 +153,7 @@ describe("The schedule next day pickup test suite", () => {
};

const args = { app, connectArgs, staticConfigTests, options };
const testSuite = new NextDayPickup(args);
const testSuite = new SchedulePickupNextDay(args);

try {
testSuite.tests();
Expand Down Expand Up @@ -186,7 +186,7 @@ describe("The schedule next day pickup test suite", () => {

const app = new CarrierApp(appDefinition);
const args = { app, connectArgs, staticConfigTests, options };
const testSuite = new NextDayPickup(args);
const testSuite = new SchedulePickupNextDay(args);
const tests = testSuite.tests();

expect(tests[0].title).to.include("deliveryServiceName: Better Delivery Service");
Expand All @@ -208,7 +208,7 @@ describe("The schedule next day pickup test suite", () => {

const app = new CarrierApp(appDefinition);
const args = { app, connectArgs, staticConfigTests, options };
const testSuite = new NextDayPickup(args);
const testSuite = new SchedulePickupNextDay(args);
const tests = testSuite.tests();

expect(tests[0].title).to.include("pickupServiceName: Better Pickup Service");
Expand All @@ -234,7 +234,7 @@ describe("The schedule next day pickup test suite", () => {
};

const args = { app, connectArgs, staticConfigTests, options };
const testSuite = new NextDayPickup(args);
const testSuite = new SchedulePickupNextDay(args);
const tests = testSuite.tests();

expect(tests[0].methodArgs.address.company).to.equal("Domestic Route #1");
Expand Down
Loading

0 comments on commit d6e251a

Please sign in to comment.