Skip to content
Open
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
5 changes: 5 additions & 0 deletions .changeset/hip-flowers-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smithy/snapshot-testing": patch
---

add response snapshot generation
5 changes: 5 additions & 0 deletions .changeset/mean-hotels-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@smithy/core": patch
---

fix typo in thrown error message
5 changes: 4 additions & 1 deletion api-snapshot/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,9 @@
"validateSchema": "function, since <=0.0.0"
},
"@smithy/snapshot-testing": {
"SnapshotRunner": "function, since <=0.0.1"
"SnapshotRunner": "function, since <=0.0.1",
"customFields": "object, since 1.0.7",
"snapshotTestingProtocolResponseSerializers": "object, since 1.0.7",
"SnapshotProtocol": "function, since 1.0.7"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ export class NormalizedSchema implements INormalizedSchema {
if (this.isDocumentSchema()) {
return member([15 satisfies DocumentSchema, 0], memberName);
}
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no no member=${memberName}.`);
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no member=${memberName}.`);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
======================== minimal response ========================
[status] 200

smithy-protocol: rpc-v2-cbor
content-type: application/cbor

[Uint8Array (cbor object view)]
{}

[actual bytes]
160


[output]
{
$metadata: {
httpStatusCode: (number) 200,
requestId: (undefined),
extendedRequestId: (undefined),
cfId: (undefined),
attempts: (number) 1,
totalRetryDelay: (number) 0
}
}

======================== w/ optional fields ========================
[status] 200

smithy-protocol: rpc-v2-cbor
content-type: application/cbor

[Uint8Array (cbor object view)]
{}

[actual bytes]
160


[output]
{
$metadata: {
httpStatusCode: (number) 200,
requestId: (undefined),
extendedRequestId: (undefined),
cfId: (undefined),
attempts: (number) 1,
totalRetryDelay: (number) 0
}
}

53 changes: 53 additions & 0 deletions packages/snapshot-testing/integ-snapshots/res/Float16.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
======================== minimal response ========================
[status] 200

smithy-protocol: rpc-v2-cbor
content-type: application/cbor

[Uint8Array (cbor object view)]
{}

[actual bytes]
160


[output]
{
$metadata: {
httpStatusCode: (number) 200,
requestId: (undefined),
extendedRequestId: (undefined),
cfId: (undefined),
attempts: (number) 1,
totalRetryDelay: (number) 0
}
}

======================== w/ optional fields ========================
[status] 200

smithy-protocol: rpc-v2-cbor
content-type: application/cbor

[Uint8Array (cbor object view)]
{
"value": 0
}

[actual bytes]
161, 101, 118, 97, 108, 117, 101, 0


[output]
{
value: (number) 0,
$metadata: {
httpStatusCode: (number) 200,
requestId: (undefined),
extendedRequestId: (undefined),
cfId: (undefined),
attempts: (number) 1,
totalRetryDelay: (number) 0
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
======================== minimal response ========================
[status] 200

smithy-protocol: rpc-v2-cbor
content-type: application/cbor

[Uint8Array (cbor object view)]
{}

[actual bytes]
160


[output]
{
$metadata: {
httpStatusCode: (number) 200,
requestId: (undefined),
extendedRequestId: (undefined),
cfId: (undefined),
attempts: (number) 1,
totalRetryDelay: (number) 0
}
}

======================== w/ optional fields ========================
[status] 200

smithy-protocol: rpc-v2-cbor
content-type: application/cbor

[Uint8Array (cbor object view)]
{
"datetime": {
"tag": 1,
"value": 946702799.999
}
}

[actual bytes]
161, 104, 100, 97, 116, 101, 116, 105, 109, 101, 193, 251, 65, 204, 54, 196, 231, 255, 223, 59


[output]
{
datetime: (Date) 12/31/1999, 11:59:59 PM,
$metadata: {
httpStatusCode: (number) 200,
requestId: (undefined),
extendedRequestId: (undefined),
cfId: (undefined),
attempts: (number) 1,
totalRetryDelay: (number) 0
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
======================== minimal response ========================
[status] 200

smithy-protocol: rpc-v2-cbor
content-type: application/cbor

[Uint8Array (cbor object view)]
{}

[actual bytes]
160


[output]
{
$metadata: {
httpStatusCode: (number) 200,
requestId: (undefined),
extendedRequestId: (undefined),
cfId: (undefined),
attempts: (number) 1,
totalRetryDelay: (number) 0
}
}

======================== w/ optional fields ========================
[status] 200

smithy-protocol: rpc-v2-cbor
content-type: application/cbor

[Uint8Array (cbor object view)]
{
"greeting": "__greeting__"
}

[actual bytes]
161, 104, 103, 114, 101, 101, 116, 105, 110, 103, 108, 95, 95, 103, 114, 101, 101, 116, 105, 110, 103, 95, 95


[output]
{
greeting: "__greeting__",
$metadata: {
httpStatusCode: (number) 200,
requestId: (undefined),
extendedRequestId: (undefined),
cfId: (undefined),
attempts: (number) 1,
totalRetryDelay: (number) 0
}
}

50 changes: 50 additions & 0 deletions packages/snapshot-testing/integ-snapshots/res/NoInputOutput.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
======================== minimal response ========================
[status] 200

smithy-protocol: rpc-v2-cbor
content-type: application/cbor

[Uint8Array (cbor object view)]
{}

[actual bytes]
160


[output]
{
$metadata: {
httpStatusCode: (number) 200,
requestId: (undefined),
extendedRequestId: (undefined),
cfId: (undefined),
attempts: (number) 1,
totalRetryDelay: (number) 0
}
}

======================== w/ optional fields ========================
[status] 200

smithy-protocol: rpc-v2-cbor
content-type: application/cbor

[Uint8Array (cbor object view)]
{}

[actual bytes]
160


[output]
{
$metadata: {
httpStatusCode: (number) 200,
requestId: (undefined),
extendedRequestId: (undefined),
cfId: (undefined),
attempts: (number) 1,
totalRetryDelay: (number) 0
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
======================== minimal response ========================
[status] 200

smithy-protocol: rpc-v2-cbor
content-type: application/cbor

[Uint8Array (cbor object view)]
{}

[actual bytes]
160


[output]
{
$metadata: {
httpStatusCode: (number) 200,
requestId: (undefined),
extendedRequestId: (undefined),
cfId: (undefined),
attempts: (number) 1,
totalRetryDelay: (number) 0
}
}

======================== w/ optional fields ========================
[status] 200

smithy-protocol: rpc-v2-cbor
content-type: application/cbor

[Uint8Array (cbor object view)]
{
"nested": {
"foo": "__foo__",
"nested": {
"bar": "__bar__",
"recursiveMember": {
"foo": "__foo__",
"nested": {
"bar": "__bar__",
"recursiveMember": {}
}
}
}
}
}

[actual bytes]
161, 102, 110, 101, 115, 116, 101, 100, 162, 99, 102, 111, 111, 103, 95, 95, 102, 111, 111, 95, 95, 102, 110, 101,
115, 116, 101, 100, 162, 99, 98, 97, 114, 103, 95, 95, 98, 97, 114, 95, 95, 111, 114, 101, 99, 117, 114, 115,
105, 118, 101, 77, 101, 109, 98, 101, 114, 162, 99, 102, 111, 111, 103, 95, 95, 102, 111, 111, 95, 95, 102, 110,
101, 115, 116, 101, 100, 162, 99, 98, 97, 114, 103, 95, 95, 98, 97, 114, 95, 95, 111, 114, 101, 99, 117, 114,
115, 105, 118, 101, 77, 101, 109, 98, 101, 114, 160


[output]
{
nested: {
foo: "__foo__",
nested: {
bar: "__bar__",
recursiveMember: {
foo: "__foo__",
nested: {
bar: "__bar__",
recursiveMember: {}
}
}
}
},
$metadata: {
httpStatusCode: (number) 200,
requestId: (undefined),
extendedRequestId: (undefined),
cfId: (undefined),
attempts: (number) 1,
totalRetryDelay: (number) 0
}
}

Loading
Loading