|
12 | 12 | public class CommandGeneratorTest { |
13 | 13 | @Test |
14 | 14 | public void addsCommandSpecificPlugins() { |
15 | | - testCommmandCodegen( |
| 15 | + testCommandCodegen( |
16 | 16 | "output-structure.smithy", |
17 | 17 | new String[] {"getSerdePlugin(config, this.serialize, this.deserialize)"} |
18 | 18 | ); |
19 | 19 | } |
20 | 20 |
|
21 | 21 | @Test |
22 | 22 | public void writesSerializer() { |
23 | | - testCommmandCodegen( |
| 23 | + testCommandCodegen( |
24 | 24 | "output-structure.smithy", |
25 | 25 | new String[] {".ser("} |
26 | 26 | ); |
27 | 27 | } |
28 | 28 |
|
29 | 29 | @Test |
30 | 30 | public void writesDeserializer() { |
31 | | - testCommmandCodegen( |
| 31 | + testCommandCodegen( |
32 | 32 | "output-structure.smithy", |
33 | 33 | new String[] {".de("} |
34 | 34 | ); |
35 | 35 | } |
36 | 36 |
|
37 | 37 | @Test |
38 | 38 | public void writesOperationContextParamValues() { |
39 | | - testCommmandCodegen( |
| 39 | + testCommandCodegen( |
40 | 40 | "endpointsV2/endpoints-operation-context-params.smithy", |
41 | 41 | new String[] { |
42 | | - "opContextParamIdentifier: { type: \"operationContextParams\", get: (input?: any) => input?.fooString }", |
43 | | - "opContextParamSubExpression: { type: \"operationContextParams\", get: (input?: any) => input?.fooObj?.bar }", |
44 | | - "opContextParamWildcardExpressionList: { type: \"operationContextParams\", get: (input?: any) => input?.fooList }", |
45 | | - "opContextParamWildcardExpressionListFlatten: { type: \"operationContextParams\", get: (input?: any) => input?.fooListList.flat() }", |
46 | | - "opContextParamWildcardExpressionListObj: { type: \"operationContextParams\", get: (input?: any) => input?.fooListObj?.map((obj: any) => obj?.key) }", |
47 | | - "opContextParamWildcardExpressionListObjListFlatten: { type: \"operationContextParams\", get: (input?: any) => input?.fooListObjList?.map((obj: any) => obj?.key).flat() }", |
48 | | - "opContextParamWildcardExpressionHash: { type: \"operationContextParams\", get: (input?: any) => Object.values(input?.fooObjObj ?? {}).map((obj: any) => obj?.bar) }", |
49 | | - "opContextParamMultiSelectList: { type: \"operationContextParams\", get: (input?: any) => input?.fooListObjObj?.map((obj: any) => [obj?.fooObject?.bar,obj?.fooString].filter((i) => i)) }", |
50 | | - "opContextParamMultiSelectListFlatten: { type: \"operationContextParams\", get: (input?: any) => input?.fooListObjObj?.map((obj: any) => [obj?.fooList].filter((i) => i).flat()) }", |
51 | | - "opContextParamKeys: { type: \"operationContextParams\", get: (input?: any) => Object.keys(input?.fooKeys ?? {}) }", |
| 42 | + """ |
| 43 | +opContextParamIdentifier: { type: "operationContextParams", get: (input?: any) => input?.fooString }""", |
| 44 | + """ |
| 45 | +opContextParamSubExpression: { type: "operationContextParams", get: (input?: any) => input?.fooObj?.bar }""", |
| 46 | + """ |
| 47 | +opContextParamWildcardExpressionList: { type: "operationContextParams", get: (input?: any) => input?.fooList }""", |
| 48 | + """ |
| 49 | +opContextParamWildcardExpressionListFlatten: { type: "operationContextParams", get: (input?: any) => input?.fooListList.flat() }""", |
| 50 | + """ |
| 51 | +opContextParamWildcardExpressionListObj: { type: "operationContextParams", get: (input?: any) => input?.fooListObj?.map((obj: any) => obj?.key) }""", |
| 52 | + """ |
| 53 | +opContextParamWildcardExpressionListObjListFlatten: { type: "operationContextParams", get: (input?: any) => input?.fooListObjList?.map((obj: any) => obj?.key).flat() }""", |
| 54 | + """ |
| 55 | +opContextParamWildcardExpressionHash: { type: "operationContextParams", get: (input?: any) => Object.values(input?.fooObjObj ?? {}).map((obj: any) => obj?.bar) }""", |
| 56 | + """ |
| 57 | +opContextParamMultiSelectList: { type: "operationContextParams", get: (input?: any) => input?.fooListObjObj?.map((obj: any) => [obj?.fooObject?.bar,obj?.fooString].filter((i) => i)) }""", |
| 58 | + """ |
| 59 | +opContextParamMultiSelectListFlatten: { type: "operationContextParams", get: (input?: any) => input?.fooListObjObj?.map((obj: any) => [obj?.fooList].filter((i) => i)).flat() }""", |
| 60 | + """ |
| 61 | +opContextParamKeys: { type: "operationContextParams", get: (input?: any) => Object.keys(input?.fooKeys ?? {}) }""", |
52 | 62 | } |
53 | 63 | ); |
54 | 64 | } |
55 | 65 |
|
56 | | - private void testCommmandCodegen(String filename, String[] expectedTypeArray) { |
| 66 | + private void testCommandCodegen(String filename, String[] expectedTypeArray) { |
57 | 67 | MockManifest manifest = new MockManifest(); |
58 | 68 | PluginContext context = PluginContext.builder() |
59 | 69 | .pluginClassLoader(getClass().getClassLoader()) |
|
0 commit comments