Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clients/client-acm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
"extract:docs": "api-extractor run --local",
"generate:client": "node ../../scripts/generate-clients/single-service --solo acm",
"test:e2e": "yarn g:vitest run -c vitest.config.e2e.mts",
"test:e2e:watch": "yarn g:vitest watch -c vitest.config.e2e.mts",
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"
},
"main": "./dist-cjs/index.js",
Expand Down
39 changes: 39 additions & 0 deletions clients/client-acm/test/acm-features.e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { getE2eTestResources } from "@aws-sdk/aws-util-test/src";
import { ACM } from "@aws-sdk/client-acm";
import { beforeAll, describe, expect, test as it } from "vitest";

describe("@aws-sdk/client-acm", () => {
let client: ACM;
let region: string;

beforeAll(async () => {
const e2eTestResourcesEnv = await getE2eTestResources();
Object.assign(process.env, e2eTestResourcesEnv);

region = process?.env?.AWS_SMOKE_TEST_REGION as string;

client = new ACM({ region });
});

describe("Making a request to ACM service", () => {
it("should successfully list certificates", async () => {
const result = await client.listCertificates({});

expect(Array.isArray(result.CertificateSummaryList)).toBe(true);
});
});

describe("Error handling", () => {
it("should handle ValidationException for invalid certificate ARN", async () => {
await expect(
client.describeCertificate({
CertificateArn: "fake_arn",
})
).rejects.toThrow(
expect.objectContaining({
name: "ValidationException",
})
);
});
});
});
10 changes: 10 additions & 0 deletions clients/client-acm/vitest.config.e2e.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
exclude: ["**/*.browser.e2e.spec.ts"],
include: ["**/*.e2e.spec.ts"],
environment: "node",
},
mode: "development",
});
2 changes: 2 additions & 0 deletions clients/client-api-gateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
"extract:docs": "api-extractor run --local",
"generate:client": "node ../../scripts/generate-clients/single-service --solo api-gateway",
"test:e2e": "yarn g:vitest run -c vitest.config.e2e.mts",
"test:e2e:watch": "yarn g:vitest watch -c vitest.config.e2e.mts",
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"
},
"main": "./dist-cjs/index.js",
Expand Down
39 changes: 39 additions & 0 deletions clients/client-api-gateway/test/apigateway-features.e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { getE2eTestResources } from "@aws-sdk/aws-util-test/src";
import { APIGateway } from "@aws-sdk/client-api-gateway";
import { beforeAll, describe, expect, test as it } from "vitest";

describe("@aws-sdk/client-api-gateway", () => {
let client: APIGateway;
let region: string;

beforeAll(async () => {
const e2eTestResourcesEnv = await getE2eTestResources();
Object.assign(process.env, e2eTestResourcesEnv);

region = process?.env?.AWS_SMOKE_TEST_REGION as string;

client = new APIGateway({ region });
});

describe("Making a request", () => {
it("should successfully get REST APIs", async () => {
const result = await client.getRestApis({});

expect(Array.isArray(result.items)).toBe(true);
});
});

describe("Error handling", () => {
it("should handle NotFoundException for invalid REST API ID", async () => {
await expect(
client.getRestApi({
restApiId: "fake_id",
})
).rejects.toThrow(
expect.objectContaining({
name: "NotFoundException",
})
);
});
});
});
10 changes: 10 additions & 0 deletions clients/client-api-gateway/vitest.config.e2e.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
exclude: ["**/*.browser.e2e.spec.ts"],
include: ["**/*.e2e.spec.ts"],
environment: "node",
},
mode: "development",
});
2 changes: 2 additions & 0 deletions clients/client-cloudformation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
"extract:docs": "api-extractor run --local",
"generate:client": "node ../../scripts/generate-clients/single-service --solo cloudformation",
"test:e2e": "yarn g:vitest run -c vitest.config.e2e.mts",
"test:e2e:watch": "yarn g:vitest watch -c vitest.config.e2e.mts",
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"
},
"main": "./dist-cjs/index.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { getE2eTestResources } from "@aws-sdk/aws-util-test/src";
import { CloudFormation, paginateListStacks } from "@aws-sdk/client-cloudformation";
import { beforeAll, describe, expect, test as it } from "vitest";

describe("@aws-sdk/client-cloudformation", () => {
let client: CloudFormation;
let region: string;

beforeAll(async () => {
const e2eTestResourcesEnv = await getE2eTestResources();
Object.assign(process.env, e2eTestResourcesEnv);

region = process?.env?.AWS_SMOKE_TEST_REGION as string;

client = new CloudFormation({ region });
});

describe("Describing stacks", () => {
it("should return stacks list when describe stacks is called", async () => {
const result = await client.describeStacks({});

expect(result).toBeDefined();
expect(result.Stacks).toBeDefined();
expect(Array.isArray(result.Stacks)).toBe(true);
});
});

describe("Error handling", () => {
it("should handle ValidationError for invalid stack creation", async () => {
const templateBody = '{"Resources":{"member":{"Type":"AWS::SQS::Queue"}}}';

await expect(
client.createStack({
TemplateBody: templateBody,
StackName: "", // Empty name should cause ValidationError
})
).rejects.toThrow(
expect.objectContaining({
name: "ValidationError",
})
);
});
});

describe("Paginating responses", () => {
it("should paginate listStacks operation", async () => {
const paginator = paginateListStacks({ client }, {});

let pageCount = 0;
let lastPage;

for await (const page of paginator) {
pageCount++;
lastPage = page;
}

expect(pageCount).toBeGreaterThanOrEqual(1);
expect(lastPage).toBeDefined();
expect(lastPage?.NextToken).toBeUndefined(); // The last page must not contain a marker
});
});
});
10 changes: 10 additions & 0 deletions clients/client-cloudformation/vitest.config.e2e.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
exclude: ["**/*.browser.e2e.spec.ts"],
include: ["**/*.e2e.spec.ts"],
environment: "node",
},
mode: "development",
});
2 changes: 2 additions & 0 deletions clients/client-cloudfront/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
"extract:docs": "api-extractor run --local",
"generate:client": "node ../../scripts/generate-clients/single-service --solo cloudfront",
"test:e2e": "yarn g:vitest run -c vitest.config.e2e.mts",
"test:e2e:watch": "yarn g:vitest watch -c vitest.config.e2e.mts",
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"
},
"main": "./dist-cjs/index.js",
Expand Down
159 changes: 159 additions & 0 deletions clients/client-cloudfront/test/cloudfront-features.e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
import { getE2eTestResources } from "@aws-sdk/aws-util-test/src";
import { CloudFront } from "@aws-sdk/client-cloudfront";
import { beforeAll, describe, expect, test as it } from "vitest";

describe("@aws-sdk/client-cloudfront", () => {
let client: CloudFront;
let region: string;

beforeAll(async () => {
const e2eTestResourcesEnv = await getE2eTestResources();
Object.assign(process.env, e2eTestResourcesEnv);

region = process?.env?.AWS_SMOKE_TEST_REGION as string;

client = new CloudFront({ region });
}, 60_000);

describe("List distributions", () => {
it("should return distribution list with quantity property", async () => {
const result = await client.listDistributions({});

expect(typeof result.DistributionList?.Quantity).toBe("number");
});
});

describe("Create a distribution", () => {
it("should handle NoSuchOrigin error for invalid origin", async () => {
const uniqueRef = `aws-js-sdk-${Date.now()}-${process.pid}-${Math.random().toString(36).substr(2, 9)}`;
const distributionConfig = {
CallerReference: uniqueRef,
Aliases: {
Quantity: 0,
},
DefaultRootObject: "",
Origins: {
Items: [
{
Id: "InvalidOrigin",
DomainName: "example.com",
CustomOriginConfig: {
HTTPPort: 80,
HTTPSPort: 443,
OriginProtocolPolicy: "match-viewer" as const,
},
},
],
Quantity: 1,
},
DefaultCacheBehavior: {
TargetOriginId: "NonExistentOrigin",
ForwardedValues: {
QueryString: false,
Cookies: {
Forward: "all" as const,
},
},
TrustedSigners: {
Items: [],
Enabled: false,
Quantity: 0,
},
ViewerProtocolPolicy: "allow-all" as const,
MinTTL: 0,
},
CacheBehaviors: {
Items: [],
Quantity: 0,
},
Comment: "",
Logging: {
Enabled: false,
Bucket: "invalidbucket.s3.amazonaws.com",
Prefix: "prefix",
IncludeCookies: false,
},
PriceClass: "PriceClass_All" as const,
Enabled: false,
};

await expect(
client.createDistribution({
DistributionConfig: distributionConfig,
})
).rejects.toThrow(
expect.objectContaining({
name: "NoSuchOrigin",
$metadata: expect.objectContaining({
httpStatusCode: 404,
}),
})
);
});
});

describe("Error handling", () => {
it("should handle InvalidArgument for empty name prefix", async () => {
const distributionConfig = {
CallerReference: "",
Aliases: {
Quantity: 0,
},
DefaultRootObject: "",
Origins: {
Items: [
{
Id: "origin",
DomainName: "example.com",
CustomOriginConfig: {
HTTPPort: 80,
HTTPSPort: 443,
OriginProtocolPolicy: "match-viewer" as const,
},
},
],
Quantity: 1,
},
DefaultCacheBehavior: {
TargetOriginId: "origin",
ForwardedValues: {
QueryString: false,
Cookies: {
Forward: "all" as const,
},
},
TrustedSigners: {
Items: [],
Enabled: false,
Quantity: 0,
},
ViewerProtocolPolicy: "allow-all" as const,
MinTTL: 0,
},
CacheBehaviors: {
Items: [],
Quantity: 0,
},
Comment: "",
Logging: {
Enabled: false,
Bucket: "invalidbucket.s3.amazonaws.com",
Prefix: "prefix",
IncludeCookies: false,
},
PriceClass: "PriceClass_All" as const,
Enabled: false,
};

await expect(
client.createDistribution({
DistributionConfig: distributionConfig,
})
).rejects.toThrow(
expect.objectContaining({
name: "InvalidArgument",
})
);
});
});
}, 60_000);
10 changes: 10 additions & 0 deletions clients/client-cloudfront/vitest.config.e2e.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
exclude: ["**/*.browser.e2e.spec.ts"],
include: ["**/*.e2e.spec.ts"],
environment: "node",
},
mode: "development",
});
2 changes: 2 additions & 0 deletions clients/client-cloudtrail/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo",
"extract:docs": "api-extractor run --local",
"generate:client": "node ../../scripts/generate-clients/single-service --solo cloudtrail",
"test:e2e": "yarn g:vitest run -c vitest.config.e2e.mts",
"test:e2e:watch": "yarn g:vitest watch -c vitest.config.e2e.mts",
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"
},
"main": "./dist-cjs/index.js",
Expand Down
Loading
Loading