Skip to content

Commit 1a51898

Browse files
committed
chores: complete fixing indentation in code gen unit tests
1 parent a1ae31c commit 1a51898

File tree

8 files changed

+57
-68
lines changed

8 files changed

+57
-68
lines changed

packages/service-types-generator/src/Components/Client/Configuration.spec.ts

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ describe("Configuration", () => {
4949

5050
expect(config.toString()).toMatch(
5151
`export interface CloudFooConfiguration {
52-
/**
53-
* Optional property
54-
*/
55-
optionalProperty?: boolean;
52+
/**
53+
* Optional property
54+
*/
55+
optionalProperty?: boolean;
5656
}`
5757
);
5858
});
@@ -61,9 +61,7 @@ describe("Configuration", () => {
6161
const config = new Configuration("CloudFoo", "node", { internalProperty });
6262

6363
expect(config.toString()).toMatch(
64-
`export interface CloudFooConfiguration {
65-
66-
}`
64+
/export interface CloudFooConfiguration \{[.\n]*\}/
6765
);
6866
});
6967

@@ -72,10 +70,10 @@ describe("Configuration", () => {
7270

7371
expect(config.toString()).toMatch(
7472
`export interface CloudFooConfiguration {
75-
/**
76-
* Required property
77-
*/
78-
requiredProperty: boolean;
73+
/**
74+
* Required property
75+
*/
76+
requiredProperty: boolean;
7977
}`
8078
);
8179
});
@@ -85,12 +83,12 @@ describe("Configuration", () => {
8583

8684
expect(config.toString()).toMatch(
8785
`export interface CloudFooConfiguration {
88-
/**
89-
* Documentation
90-
*
91-
* Node documentation
92-
*/
93-
forkedProperty: boolean;
86+
/**
87+
* Documentation
88+
*
89+
* Node documentation
90+
*/
91+
forkedProperty: boolean;
9492
}`
9593
);
9694
});
@@ -100,10 +98,10 @@ describe("Configuration", () => {
10098

10199
expect(config.toString()).toMatch(
102100
`export interface CloudFooConfiguration {
103-
/**
104-
* Documentation
105-
*/
106-
forkedProperty: boolean;
101+
/**
102+
* Documentation
103+
*/
104+
forkedProperty: boolean;
107105
}`
108106
);
109107
});
@@ -113,16 +111,14 @@ describe("Configuration", () => {
113111
const stringified = config.toString();
114112

115113
expect(stringified).toMatch(
116-
`export interface CloudFooConfiguration {
117-
118-
}`
114+
/export interface CloudFooConfiguration \{[.\n]*\}/
119115
);
120116
expect(stringified).toMatch(
121117
`export interface CloudFooResolvableConfiguration extends CloudFooConfiguration {
122-
/**
123-
* Internal property
124-
*/
125-
internalProperty: boolean;
118+
/**
119+
* Internal property
120+
*/
121+
internalProperty: boolean;
126122
}`
127123
);
128124
});
@@ -132,7 +128,7 @@ describe("Configuration", () => {
132128

133129
expect(config.toString()).toMatch(
134130
`export interface CloudFooResolvedConfiguration extends CloudFooConfiguration {
135-
optionalProperty: boolean;
131+
optionalProperty: boolean;
136132
}`
137133
);
138134
});
@@ -142,12 +138,12 @@ describe("Configuration", () => {
142138

143139
expect(config.toString()).toMatch(
144140
`export const configurationProperties: __aws_sdk_types.ConfigurationDefinition<
145-
CloudFooResolvableConfiguration,
146-
CloudFooResolvedConfiguration
141+
CloudFooResolvableConfiguration,
142+
CloudFooResolvedConfiguration
147143
> = {
148-
optionalProperty: {
149-
defaultValue: true
150-
},
144+
optionalProperty: {
145+
defaultValue: true
146+
},
151147
};`
152148
);
153149
});

packages/service-types-generator/src/Components/Client/Configuration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ ${new IndentedSection(this.resolvedConfiguration())}
4343
export const configurationProperties: ${packageNameToVariable(
4444
"@aws-sdk/types"
4545
)}.ConfigurationDefinition<
46-
${this.prefix}ResolvableConfiguration,
47-
${this.prefix}ResolvedConfiguration
46+
${this.prefix}ResolvableConfiguration,
47+
${this.prefix}ResolvedConfiguration
4848
> = {
4949
${new IndentedSection(this.configurationProperties())}
5050
};

packages/service-types-generator/src/Components/Model/Map.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export const MyMap: _Map_ = {
252252
type: 'map',
253253
key: {
254254
shape: {
255-
type: 'string',
255+
type: 'string',
256256
},
257257
},
258258
get value(): _Member_ {

packages/service-types-generator/src/Components/Model/Map.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,12 @@ export class Map {
3535
) {
3636
useGetter = true;
3737
properties.push(`get ${memberName}(): _Member_ {
38-
Object.defineProperty(${
39-
this.shape.name
40-
}, '${memberName}', {value: ${new IndentedSection(new MemberRef(member))
41-
.toString()
42-
.replace(/^\s+/, "")}});
43-
return ${new IndentedSection(new MemberRef(member))
44-
.toString()
45-
.replace(/^\s+/, "")};
38+
${new IndentedSection(`Object.defineProperty(${
39+
this.shape.name
40+
}, '${memberName}', {value: ${new MemberRef(member)
41+
.toString()
42+
.replace(/^\s+/, "")}});
43+
return ${new MemberRef(member).toString().replace(/^\s+/, "")};`)}
4644
}`);
4745
} else {
4846
properties.push(`${memberName}: ${new MemberRef(member)}`);

packages/service-types-generator/src/Components/Model/Structure.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ export const foo: _Structure_ = {
281281
return {
282282
shape: bar,
283283
};
284-
},
284+
},
285285
},
286286
};`
287287
);

packages/service-types-generator/src/Components/Model/Structure.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,12 @@ ${new IndentedSection(properties.join(",\n"))},
8484
) {
8585
this.useGetter = true;
8686
membersProps.push(`get ${memberName}(): _Member_ {
87-
Object.defineProperty(${
88-
this.shape.name
89-
}, '${memberName}', {value: ${new IndentedSection(new MemberRef(member))
90-
.toString()
91-
.replace(/^\s+/, "")}});
92-
return ${new IndentedSection(new MemberRef(member))
93-
.toString()
94-
.replace(/^\s+/, "")};
87+
${new IndentedSection(`Object.defineProperty(${
88+
this.shape.name
89+
}, '${memberName}', {value: ${new MemberRef(member)
90+
.toString()
91+
.replace(/^\s+/, "")}});
92+
return ${new MemberRef(member).toString().replace(/^\s+/, "")};`)}
9593
}`);
9694
} else {
9795
membersProps.push(`${memberName}: ${new MemberRef(member)}`);

packages/service-types-generator/src/Components/Type/Structure.spec.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ describe("Structure", () => {
3535
* A structure
3636
*/
3737
export interface ${name} {
38-
/**
39-
* blob
40-
*/
41-
data: ${getInterfaceType(blob)};
38+
/**
39+
* blob
40+
*/
41+
data: ${getInterfaceType(blob)};
4242
}
4343
4444
export interface ${getUnmarshalledShapeName(name)} extends ${name} {
45-
/**
46-
* blob
47-
*/
48-
data: ${getMemberType(blob)};
45+
/**
46+
* blob
47+
*/
48+
data: ${getMemberType(blob)};
4949
}`
5050
);
5151
});
@@ -71,10 +71,7 @@ export interface ${getUnmarshalledShapeName(name)} extends ${name} {
7171
const dataMember = inputShape.members.data;
7272

7373
expect(new Input(inputShape, "universal").toString()).toMatch(
74-
` /**
75-
* CORRECT
76-
*/
77-
data?: ${getInterfaceType(dataMember.shape, dataMember)};`
74+
`data?: ${getInterfaceType(dataMember.shape, dataMember)};`
7875
);
7976
});
8077
});

packages/service-types-generator/src/SmokeTestGenerator.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe("SmokeTestGenerator", () => {
6464

6565
expect(typeof map.get(testFileName)).toBe("string");
6666
expect(map.get(testFileName)).toMatch(
67-
`defaultRegion = defaultRegion || 'us-west-1'`
67+
`defaultRegion = defaultRegion || "us-west-1"`
6868
);
6969
expect(map.get(testFileName)).toMatch(
7070
`declare let defaultRegion: string;`
@@ -135,7 +135,7 @@ describe("SmokeTestGenerator", () => {
135135

136136
expect(typeof map.get(testFileName)).toBe("string");
137137
expect(map.get(testFileName)).toMatch(
138-
`const defaultRegion = process.env.AWS_SMOKE_TEST_REGION || 'us-west-2'`
138+
`const defaultRegion = process.env.AWS_SMOKE_TEST_REGION || "us-west-2"`
139139
);
140140
});
141141
});

0 commit comments

Comments
 (0)