Skip to content

Commit

Permalink
test: remove redundant function is(Endpoint|Error)Expectation
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr committed Aug 9, 2024
1 parent 728b7b9 commit 8d6af17
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions tests/endpoints-2.0/endpoints-integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { EndpointParameters, EndpointV2 } from "@smithy/types";
import * as fs from "fs";
import * as path from "path";

import { EndpointExpectation, EndpointTestCase, ErrorExpectation, ServiceNamespace } from "./integration-test-types";
import { EndpointExpectation, EndpointTestCase, ServiceNamespace } from "./integration-test-types";

describe("client list", () => {
const root = path.join(__dirname, "..", "..");
Expand Down Expand Up @@ -84,7 +84,7 @@ async function runTestCase(
params.serviceId = serviceId;

it(documentation || "undocumented testcase", async () => {
if (isEndpointExpectation(expectation)) {
if ("endpoint" in expectation) {
const { endpoint } = expectation;
if (operationInputs) {
for (const operationInput of operationInputs) {
Expand All @@ -99,7 +99,7 @@ async function runTestCase(
assertEndpointResolvedCorrectly(endpoint, observed);
}
}
if (isErrorExpectation(expectation)) {
if ("error" in expectation) {
const { error } = expectation;
const pass = (err: any) => err;
const normalizeQuotes = (s: string) => s.replace(/`/g, "");
Expand Down Expand Up @@ -140,11 +140,3 @@ function assertEndpointResolvedCorrectly(expected: EndpointExpectation["endpoint
expect(observed.properties?.authSchemes).toEqual(authSchemes);
}
}

function isEndpointExpectation(expectation: object): expectation is EndpointExpectation {
return "endpoint" in expectation;
}

function isErrorExpectation(expectation: object): expectation is ErrorExpectation {
return "error" in expectation;
}

0 comments on commit 8d6af17

Please sign in to comment.