Skip to content

Commit c83ad35

Browse files
JordonPhillipssrchase
authored andcommitted
Format integ test ts code
1 parent 3284328 commit c83ad35

File tree

5 files changed

+156
-110
lines changed

5 files changed

+156
-110
lines changed

smithy-typescript-integ-tests/codegen/smithy-build.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"version" : "1.0",
3-
"outputDirectory" : "build/output",
4-
"projections" : {
5-
"ts-server" : {
2+
"version": "1.0",
3+
"outputDirectory": "build/output",
4+
"projections": {
5+
"ts-server": {
66
"plugins": {
7-
"typescript-ssdk-codegen" : {
8-
"package" : "@aws-smithy/typescript-integ-test-types",
7+
"typescript-ssdk-codegen": {
8+
"package": "@aws-smithy/typescript-integ-test-types",
99
"packageVersion": "1.0.0"
1010
}
1111
}
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module.exports = {
2-
preset: "ts-jest",
3-
testEnvironment: "node",
4-
transform: {
5-
"^.+\\.(ts|tsx)$": "ts-jest",
6-
},
7-
testMatch: ["**/src/**/?(*.)+(spec|test).ts"],
8-
globals: {
9-
"ts-jest": {
10-
tsconfig: "tsconfig.json",
11-
},
2+
preset: "ts-jest",
3+
testEnvironment: "node",
4+
transform: {
5+
"^.+\\.(ts|tsx)$": "ts-jest",
6+
},
7+
testMatch: ["**/src/**/?(*.)+(spec|test).ts"],
8+
globals: {
9+
"ts-jest": {
10+
tsconfig: "tsconfig.json",
1211
},
12+
},
1313
};

smithy-typescript-integ-tests/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
},
2121
"author": "AWS Smithy Team",
2222
"license": "Apache-2.0",
23-
"dependencies": {
24-
},
23+
"dependencies": {},
2524
"devDependencies": {
2625
"@types/jest": "^26.0.22",
2726
"@types/node": "^14.14.37",

smithy-typescript-integ-tests/src/length.spec.ts

Lines changed: 131 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -13,93 +13,137 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
import {LengthTests} from "@aws-smithy/typescript-integ-test-types";
16+
import { LengthTests } from "@aws-smithy/typescript-integ-test-types";
1717

1818
describe("length constraints", () => {
19-
it("work for strings", () => {
20-
expect(LengthTests.validate({ minMaxLengthString: "much longer than 7" })).toEqual([{
21-
constraintType: "length",
22-
constraintValues: [ 2, 7 ],
23-
failureValue: 18,
24-
memberName: "minMaxLengthString",
25-
}]);
26-
expect(LengthTests.validate({ minMaxLengthString: "a" })).toEqual([{
27-
constraintType: "length",
28-
constraintValues: [ 2, 7 ],
29-
failureValue: 1,
30-
memberName: "minMaxLengthString",
31-
}]);
32-
});
33-
it("work for maps", () => {
34-
expect(LengthTests.validate({ minMaxLengthMap: { "abc": 1 }})).toEqual([{
35-
constraintType: "length",
36-
constraintValues: [ 2, 4 ],
37-
failureValue: 1,
38-
memberName: "minMaxLengthMap",
39-
}]);
40-
expect(LengthTests.validate({ minMaxLengthMap: { "abc": 1, "bcd": 2, "cde": 3, "def": 4, "efg": 5 }})).toEqual([{
41-
constraintType: "length",
42-
constraintValues: [ 2, 4 ],
43-
failureValue: 5,
44-
memberName: "minMaxLengthMap",
45-
}]);
46-
});
47-
it("also work on map keys", () => {
48-
expect(LengthTests.validate({ minMaxLengthMap: { "a": 1, "bcd": 2, "cde": 3 }})).toEqual([{
49-
constraintType: "length",
50-
constraintValues: [ 2, 7 ],
51-
failureValue: 1,
52-
memberName: "minMaxLengthMap",
53-
}]);
54-
expect(LengthTests.validate({ minMaxLengthMap: { "abcdefghijk": 5, "bcd": 2, "cde": 3 }})).toEqual([{
55-
constraintType: "length",
56-
constraintValues: [ 2, 7 ],
57-
failureValue: 11,
58-
memberName: "minMaxLengthMap",
59-
}]);
60-
});
61-
it("work for lists", () => {
62-
expect(LengthTests.validate({ minMaxLengthList: ["abc"]})).toEqual([{
63-
constraintType: "length",
64-
constraintValues: [ 2, 4 ],
65-
failureValue: 1,
66-
memberName: "minMaxLengthList",
67-
}]);
68-
expect(LengthTests.validate({ minMaxLengthList: [ "abc", "bcd", "cde", "def", "efg" ]})).toEqual([{
69-
constraintType: "length",
70-
constraintValues: [ 2, 4 ],
71-
failureValue: 5,
72-
memberName: "minMaxLengthList",
73-
}]);
74-
});
75-
it("also work on list values", () => {
76-
expect(LengthTests.validate({ minMaxLengthList: ["abcdefghijk", "def"]})).toEqual([{
77-
constraintType: "length",
78-
constraintValues: [ 2, 7 ],
79-
failureValue: 11,
80-
memberName: "minMaxLengthList",
81-
}]);
82-
});
83-
it("work for blobs", () => {
84-
expect(LengthTests.validate({ minMaxLengthBlob: Buffer.of(1) })).toEqual([{
85-
constraintType: "length",
86-
constraintValues: [ 2, 4 ],
87-
failureValue: 1,
88-
memberName: "minMaxLengthBlob",
89-
}]);
90-
expect(LengthTests.validate({ minMaxLengthBlob: Buffer.of(1, 2, 3, 4, 5)})).toEqual([{
91-
constraintType: "length",
92-
constraintValues: [ 2, 4 ],
93-
failureValue: 5,
94-
memberName: "minMaxLengthBlob",
95-
}]);
96-
});
97-
it("can be overridden on members", () => {
98-
expect(LengthTests.validate({ minMaxLengthOverride: "abcdef" })).toEqual([{
99-
constraintType: "length",
100-
constraintValues: [ 13, 27 ],
101-
failureValue: 6,
102-
memberName: "minMaxLengthOverride",
103-
}]);
104-
})
19+
it("work for strings", () => {
20+
expect(
21+
LengthTests.validate({ minMaxLengthString: "much longer than 7" })
22+
).toEqual([
23+
{
24+
constraintType: "length",
25+
constraintValues: [2, 7],
26+
failureValue: 18,
27+
memberName: "minMaxLengthString",
28+
},
29+
]);
30+
expect(LengthTests.validate({ minMaxLengthString: "a" })).toEqual([
31+
{
32+
constraintType: "length",
33+
constraintValues: [2, 7],
34+
failureValue: 1,
35+
memberName: "minMaxLengthString",
36+
},
37+
]);
38+
});
39+
it("work for maps", () => {
40+
expect(LengthTests.validate({ minMaxLengthMap: { abc: 1 } })).toEqual([
41+
{
42+
constraintType: "length",
43+
constraintValues: [2, 4],
44+
failureValue: 1,
45+
memberName: "minMaxLengthMap",
46+
},
47+
]);
48+
expect(
49+
LengthTests.validate({
50+
minMaxLengthMap: { abc: 1, bcd: 2, cde: 3, def: 4, efg: 5 },
51+
})
52+
).toEqual([
53+
{
54+
constraintType: "length",
55+
constraintValues: [2, 4],
56+
failureValue: 5,
57+
memberName: "minMaxLengthMap",
58+
},
59+
]);
60+
});
61+
it("also work on map keys", () => {
62+
expect(
63+
LengthTests.validate({ minMaxLengthMap: { a: 1, bcd: 2, cde: 3 } })
64+
).toEqual([
65+
{
66+
constraintType: "length",
67+
constraintValues: [2, 7],
68+
failureValue: 1,
69+
memberName: "minMaxLengthMap",
70+
},
71+
]);
72+
expect(
73+
LengthTests.validate({
74+
minMaxLengthMap: { abcdefghijk: 5, bcd: 2, cde: 3 },
75+
})
76+
).toEqual([
77+
{
78+
constraintType: "length",
79+
constraintValues: [2, 7],
80+
failureValue: 11,
81+
memberName: "minMaxLengthMap",
82+
},
83+
]);
84+
});
85+
it("work for lists", () => {
86+
expect(LengthTests.validate({ minMaxLengthList: ["abc"] })).toEqual([
87+
{
88+
constraintType: "length",
89+
constraintValues: [2, 4],
90+
failureValue: 1,
91+
memberName: "minMaxLengthList",
92+
},
93+
]);
94+
expect(
95+
LengthTests.validate({
96+
minMaxLengthList: ["abc", "bcd", "cde", "def", "efg"],
97+
})
98+
).toEqual([
99+
{
100+
constraintType: "length",
101+
constraintValues: [2, 4],
102+
failureValue: 5,
103+
memberName: "minMaxLengthList",
104+
},
105+
]);
106+
});
107+
it("also work on list values", () => {
108+
expect(
109+
LengthTests.validate({ minMaxLengthList: ["abcdefghijk", "def"] })
110+
).toEqual([
111+
{
112+
constraintType: "length",
113+
constraintValues: [2, 7],
114+
failureValue: 11,
115+
memberName: "minMaxLengthList",
116+
},
117+
]);
118+
});
119+
it("work for blobs", () => {
120+
expect(LengthTests.validate({ minMaxLengthBlob: Buffer.of(1) })).toEqual([
121+
{
122+
constraintType: "length",
123+
constraintValues: [2, 4],
124+
failureValue: 1,
125+
memberName: "minMaxLengthBlob",
126+
},
127+
]);
128+
expect(
129+
LengthTests.validate({ minMaxLengthBlob: Buffer.of(1, 2, 3, 4, 5) })
130+
).toEqual([
131+
{
132+
constraintType: "length",
133+
constraintValues: [2, 4],
134+
failureValue: 5,
135+
memberName: "minMaxLengthBlob",
136+
},
137+
]);
138+
});
139+
it("can be overridden on members", () => {
140+
expect(LengthTests.validate({ minMaxLengthOverride: "abcdef" })).toEqual([
141+
{
142+
constraintType: "length",
143+
constraintValues: [13, 27],
144+
failureValue: 6,
145+
memberName: "minMaxLengthOverride",
146+
},
147+
]);
148+
});
105149
});

smithy-typescript-integ-tests/src/nested.spec.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
import {NestedUnionOne} from "@aws-smithy/typescript-integ-test-types";
16+
import { NestedUnionOne } from "@aws-smithy/typescript-integ-test-types";
1717

1818
describe("ridiculously nested structures", () => {
19-
it("still work", () => {
20-
expect(NestedUnionOne.validate({ value1: { value2: [ { unions: [ { value3: "abcdefg"}] } ] } }))
21-
.toEqual([]);
22-
})
19+
it("still work", () => {
20+
expect(
21+
NestedUnionOne.validate({
22+
value1: { value2: [{ unions: [{ value3: "abcdefg" }] }] },
23+
})
24+
).toEqual([]);
25+
});
2326
});

0 commit comments

Comments
 (0)