Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ test-protocols: bundles
yarn g:vitest run -c vitest.config.protocols.integ.mts

snapshot-compare:
SNAPSHOT_MODE=compare yarn g:vitest run -c vitest.config.snapshots.integ.mts
NODE_OPTIONS='--max-old-space-size=8192' SNAPSHOT_MODE=compare \
yarn g:vitest run -c vitest.config.snapshots.integ.mts

snapshot-write:
SNAPSHOT_MODE=write yarn g:vitest run -c vitest.config.snapshots.integ.mts
NODE_OPTIONS='--max-old-space-size=8192' SNAPSHOT_MODE=write \
yarn g:vitest run -c vitest.config.snapshots.integ.mts

test-schema: bundles
yarn g:vitest run -c vitest.config.protocols-schema.integ.mts
Expand Down
10 changes: 8 additions & 2 deletions clients/client-appconfigdata/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
"clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
"extract:docs": "api-extractor run --local",
"generate:client": "node ../../scripts/generate-clients/single-service --solo appconfigdata",
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"
"test": "yarn g:vitest run --passWithNoTests",
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs",
"test:integration": "yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts",
"test:integration:watch": "yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts",
"test:watch": "yarn g:vitest watch --passWithNoTests"
},
"main": "./dist-cjs/index.js",
"types": "./dist-types/index.d.ts",
Expand Down Expand Up @@ -61,12 +65,14 @@
"tslib": "^2.6.2"
},
"devDependencies": {
"@smithy/snapshot-testing": "^1.0.7",
"@tsconfig/node20": "20.1.8",
"@types/node": "^20.14.8",
"concurrently": "7.0.0",
"downlevel-dts": "0.10.1",
"premove": "4.0.0",
"typescript": "~5.8.3"
"typescript": "~5.8.3",
"vitest": "^4.0.17"
},
"engines": {
"node": ">=20.0.0"
Expand Down
42 changes: 42 additions & 0 deletions clients/client-appconfigdata/test/snapshots.integ.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// smithy-typescript generated code
import { SnapshotRunner } from "@smithy/snapshot-testing";
import { join } from "node:path";
import { describe, expect, test as it, vi } from "vitest";

import {
AppConfigDataClient,
GetLatestConfiguration$,
GetLatestConfigurationCommand,
StartConfigurationSession$,
StartConfigurationSessionCommand,
} from "../src";

vi.setSystemTime(new Date(946702799999));
const Client = AppConfigDataClient;

const mode = (process.env.SNAPSHOT_MODE as "write" | "compare") ?? "write";

describe(
"AppConfigDataClient" + ` (${mode})`,
() => {
const runner = new SnapshotRunner({
snapshotDirPath: join(__dirname, "snapshots"),
Client,
mode,
testCase(caseName: string, run: () => Promise<void>) {
it(caseName, run);
},
assertions(caseName: string, expected: string, actual: string): Promise<void> {
expect(actual).toEqual(expected);
return Promise.resolve();
},
schemas: new Map<any, any>([
[GetLatestConfiguration$, GetLatestConfigurationCommand],
[StartConfigurationSession$, StartConfigurationSessionCommand],
]),
});

runner.run();
},
30_000
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
GET https://appconfigdata.us-east-1.amazonaws.com
/configuration?configuration_token=__ConfigurationToken__

x-amz-user-agent: aws-sdk-js/3.___._
user-agent: aws-sdk-js/3.___._ ua/2.1 lang/js md/nodejs#_.__ api/appconfigdata#_.__ m/E,e
host: appconfigdata.us-east-1.amazonaws.com
amz-sdk-invocation-id: 1111abcd-uuid-uuid-uuid-000000001111
amz-sdk-request: attempt=1; max=3
x-amz-date: 19991231T235959Z
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
authorization: AWS4-HMAC-SHA256 Credential=***/19991231/us-east-1/appconfig/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;host;x-amz-content-sha256;x-amz-date;x-amz-user-agent, Signature=***

[no body]

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
POST https://appconfigdata.us-east-1.amazonaws.com
/configurationsessions

content-type: application/json
content-length: 216
x-amz-user-agent: aws-sdk-js/3.___._
user-agent: aws-sdk-js/3.___._ ua/2.1 lang/js md/nodejs#_.__ api/appconfigdata#_.__ m/E,e
host: appconfigdata.us-east-1.amazonaws.com
amz-sdk-invocation-id: 1111abcd-uuid-uuid-uuid-000000001111
amz-sdk-request: attempt=1; max=3
x-amz-date: 19991231T235959Z
x-amz-content-sha256: 69cbe1ca2e7167c598a03db44f0ef0615d5fa57f7235bb15b8f1392a850b72d7
authorization: AWS4-HMAC-SHA256 Credential=***/19991231/us-east-1/appconfig/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-user-agent, Signature=***

[string (json)]
{
"ApplicationIdentifier": "__ApplicationIdentifier__",
"EnvironmentIdentifier": "__EnvironmentIdentifier__",
"ConfigurationProfileIdentifier": "__ConfigurationProfileIdentifier__",
"RequiredMinimumPollIntervalInSeconds": 0
}
8 changes: 8 additions & 0 deletions clients/client-appconfigdata/vitest.config.integ.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
include: ["**/*.integ.spec.ts"],
environment: "node",
},
});
9 changes: 9 additions & 0 deletions clients/client-appconfigdata/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
exclude: ["**/*.{integ}.spec.ts"],
include: ["**/*.spec.ts"],
globals: true,
},
});
10 changes: 8 additions & 2 deletions clients/client-bedrock-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
"clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
"extract:docs": "api-extractor run --local",
"generate:client": "node ../../scripts/generate-clients/single-service --solo bedrock-runtime",
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"
"test": "yarn g:vitest run --passWithNoTests",
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs",
"test:integration": "yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts",
"test:integration:watch": "yarn g:vitest run --passWithNoTests -c vitest.config.integ.mts",
"test:watch": "yarn g:vitest watch --passWithNoTests"
},
"main": "./dist-cjs/index.js",
"types": "./dist-types/index.d.ts",
Expand Down Expand Up @@ -68,12 +72,14 @@
"tslib": "^2.6.2"
},
"devDependencies": {
"@smithy/snapshot-testing": "^1.0.7",
"@tsconfig/node20": "20.1.8",
"@types/node": "^20.14.8",
"concurrently": "7.0.0",
"downlevel-dts": "0.10.1",
"premove": "4.0.0",
"typescript": "~5.8.3"
"typescript": "~5.8.3",
"vitest": "^4.0.17"
},
"engines": {
"node": ">=20.0.0"
Expand Down
66 changes: 66 additions & 0 deletions clients/client-bedrock-runtime/test/snapshots.integ.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// smithy-typescript generated code
import { SnapshotRunner } from "@smithy/snapshot-testing";
import { join } from "node:path";
import { describe, expect, test as it, vi } from "vitest";

import {
ApplyGuardrail$,
ApplyGuardrailCommand,
BedrockRuntimeClient,
Converse$,
ConverseCommand,
ConverseStream$,
ConverseStreamCommand,
CountTokens$,
CountTokensCommand,
GetAsyncInvoke$,
GetAsyncInvokeCommand,
InvokeModel$,
InvokeModelCommand,
InvokeModelWithBidirectionalStream$,
InvokeModelWithBidirectionalStreamCommand,
InvokeModelWithResponseStream$,
InvokeModelWithResponseStreamCommand,
ListAsyncInvokes$,
ListAsyncInvokesCommand,
StartAsyncInvoke$,
StartAsyncInvokeCommand,
} from "../src";

vi.setSystemTime(new Date(946702799999));
const Client = BedrockRuntimeClient;

const mode = (process.env.SNAPSHOT_MODE as "write" | "compare") ?? "write";

describe(
"BedrockRuntimeClient" + ` (${mode})`,
() => {
const runner = new SnapshotRunner({
snapshotDirPath: join(__dirname, "snapshots"),
Client,
mode,
testCase(caseName: string, run: () => Promise<void>) {
it(caseName, run);
},
assertions(caseName: string, expected: string, actual: string): Promise<void> {
expect(actual).toEqual(expected);
return Promise.resolve();
},
schemas: new Map<any, any>([
[ApplyGuardrail$, ApplyGuardrailCommand],
[Converse$, ConverseCommand],
[ConverseStream$, ConverseStreamCommand],
[CountTokens$, CountTokensCommand],
[GetAsyncInvoke$, GetAsyncInvokeCommand],
[InvokeModel$, InvokeModelCommand],
[InvokeModelWithBidirectionalStream$, InvokeModelWithBidirectionalStreamCommand],
[InvokeModelWithResponseStream$, InvokeModelWithResponseStreamCommand],
[ListAsyncInvokes$, ListAsyncInvokesCommand],
[StartAsyncInvoke$, StartAsyncInvokeCommand],
]),
});

runner.run();
},
30_000
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
POST https://bedrock-runtime.us-east-1.amazonaws.com
/guardrail/__guardrailIdentifier__/version/__guardrailVersion__/apply

content-type: application/json
content-length: 297
x-amz-user-agent: aws-sdk-js/3.___._
user-agent: aws-sdk-js/3.___._ ua/2.1 lang/js md/nodejs#_.__ api/bedrock-runtime#_.__ m/E,e
host: bedrock-runtime.us-east-1.amazonaws.com
amz-sdk-invocation-id: 1111abcd-uuid-uuid-uuid-000000001111
amz-sdk-request: attempt=1; max=3
x-amz-date: 19991231T235959Z
x-amz-content-sha256: 9c7975b8031b79ec9d5eb191697d8c7eeedac2e46613cd0822bf0de0472cbe6b
authorization: AWS4-HMAC-SHA256 Credential=***/19991231/us-east-1/bedrock/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-content-sha256;x-amz-date;x-amz-user-agent, Signature=***

[string (json)]
{
"source": "__source__",
"content": [
{
"text": {
"text": "__text__",
"qualifiers": [
"__member__",
"__member__",
"__member__"
]
}
},
{
"image": {
"format": "__format__",
"source": {
"bytes": "AQAAAQ=="
}
}
},
{
"text": {
"text": "__text__",
"qualifiers": [
"__member__",
"__member__",
"__member__"
]
}
}
],
"outputScope": "__outputScope__"
}
Loading
Loading