Skip to content

Commit 84930bb

Browse files
committed
Test callsFilterForListWithUnionWithSensitiveData
1 parent b60266d commit 84930bb

File tree

3 files changed

+43
-4
lines changed

3 files changed

+43
-4
lines changed

smithy-typescript-codegen/src/test/java/software/amazon/smithy/typescript/codegen/StructureGeneratorTest.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ public void filtersSensitiveMemberPointingToUnion() {
202202
}
203203

204204
@Test
205-
public void callsFilterForListWithSensitiveData() {
206-
testStructureCodegen("test-list-with-sensitive-data.smithy",
205+
public void callsFilterForListWithStructureWithSensitiveData() {
206+
testStructureCodegen("test-list-with-structure-with-sensitive-data.smithy",
207207
" export const filterSensitiveLog = (obj: GetFooInput): any => ({\n"
208208
+ " ...obj,\n"
209209
+ " ...(obj.foo && { foo:\n"
@@ -216,8 +216,8 @@ public void callsFilterForListWithSensitiveData() {
216216
}
217217

218218
@Test
219-
public void callsFilterInListWithSensitiveData() {
220-
testStructureCodegen("test-list-with-sensitive-data.smithy",
219+
public void callsFilterInListWithStructureWithSensitiveData() {
220+
testStructureCodegen("test-list-with-structure-with-sensitive-data.smithy",
221221
" export const filterSensitiveLog = (obj: User): any => ({\n"
222222
+ " ...obj,\n"
223223
+ " ...(obj.password && { password:\n"
@@ -226,6 +226,20 @@ public void callsFilterInListWithSensitiveData() {
226226
+ " })\n");
227227
}
228228

229+
@Test
230+
public void callsFilterForListWithUnionWithSensitiveData() {
231+
testStructureCodegen("test-list-with-union-with-sensitive-data.smithy",
232+
" export const filterSensitiveLog = (obj: GetFooInput): any => ({\n"
233+
+ " ...obj,\n"
234+
+ " ...(obj.foo && { foo:\n"
235+
+ " obj.foo.map(\n"
236+
+ " item =>\n"
237+
+ " TestUnion.filterSensitiveLog(item)\n"
238+
+ " )\n"
239+
+ " }),\n"
240+
+ " })\n");
241+
}
242+
229243
@Test
230244
public void callsFilterForListWithSensitiveMember() {
231245
testStructureCodegen("test-list-with-sensitive-member.smithy",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
namespace smithy.example
2+
3+
service Example {
4+
version: "1.0.0",
5+
operations: [GetFoo]
6+
}
7+
8+
operation GetFoo {
9+
input: GetFooInput
10+
}
11+
12+
structure GetFooInput {
13+
foo: UserList
14+
}
15+
16+
list UserList {
17+
member: TestUnion
18+
}
19+
20+
union TestUnion {
21+
bar: String,
22+
23+
@sensitive
24+
sensitiveBar: String
25+
}

0 commit comments

Comments
 (0)