From 8d6af172e0c23c0d87187be7c4f6f06ca4446c17 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Fri, 9 Aug 2024 19:21:52 +0000 Subject: [PATCH] test: remove redundant function is(Endpoint|Error)Expectation --- tests/endpoints-2.0/endpoints-integration.spec.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tests/endpoints-2.0/endpoints-integration.spec.ts b/tests/endpoints-2.0/endpoints-integration.spec.ts index 71fbc5a414c7d..69f8ff6b8d917 100644 --- a/tests/endpoints-2.0/endpoints-integration.spec.ts +++ b/tests/endpoints-2.0/endpoints-integration.spec.ts @@ -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, "..", ".."); @@ -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) { @@ -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, ""); @@ -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; -}