Skip to content

Commit b0c1272

Browse files
authored
Merge pull request #368 from aws-amplify/master
Release Amplify Codegen V2.27.1
2 parents d63a5c7 + 4750358 commit b0c1272

File tree

4 files changed

+111
-117
lines changed

4 files changed

+111
-117
lines changed

packages/appsync-modelgen-plugin/src/__tests__/visitors/appsync-javascript-visitor.test.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,15 @@ describe('Javascript visitor', () => {
127127
readonly name?: string;
128128
readonly bar?: string;
129129
readonly foo?: Bar[];
130-
constructor(init: ModelInit<SimpleModel>);
131-
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel>) => MutableModel<SimpleModel> | void): SimpleModel;
130+
constructor(init: ModelInit<SimpleModel, SimpleModelMetaData>);
131+
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel, SimpleModelMetaData>) => MutableModel<SimpleModel, SimpleModelMetaData> | void): SimpleModel;
132132
}
133133
134134
export declare class Bar {
135135
readonly id: string;
136136
readonly simpleModelFooId?: string;
137-
constructor(init: ModelInit<Bar>);
138-
static copyOf(source: Bar, mutator: (draft: MutableModel<Bar>) => MutableModel<Bar> | void): Bar;
137+
constructor(init: ModelInit<Bar, BarMetaData>);
138+
static copyOf(source: Bar, mutator: (draft: MutableModel<Bar, BarMetaData>) => MutableModel<Bar, BarMetaData> | void): Bar;
139139
}"
140140
`);
141141
expect(generateImportSpy).toBeCalledTimes(1);
@@ -147,7 +147,7 @@ describe('Javascript visitor', () => {
147147
expect(generateModelDeclarationSpy).toBeCalledTimes(3);
148148
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(1, (declarationVisitor as any).modelMap['SimpleModel'], true);
149149
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(2, (declarationVisitor as any).modelMap['Bar'], true);
150-
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(3, (declarationVisitor as any).nonModelMap['SimpleNonModelType'], true);
150+
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(3, (declarationVisitor as any).nonModelMap['SimpleNonModelType'], true, false);
151151
});
152152

153153
it('should generate Javascript declaration with model metadata types', () => {
@@ -210,7 +210,7 @@ describe('Javascript visitor', () => {
210210
expect(generateModelDeclarationSpy).toBeCalledTimes(3);
211211
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(1, (declarationVisitor as any).modelMap['SimpleModel'], true);
212212
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(2, (declarationVisitor as any).modelMap['Bar'], true);
213-
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(3, (declarationVisitor as any).nonModelMap['SimpleNonModelType'], true);
213+
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(3, (declarationVisitor as any).nonModelMap['SimpleNonModelType'], true, false);
214214
});
215215
});
216216

@@ -313,8 +313,8 @@ describe('Javascript visitor with default owner auth', () => {
313313
readonly id: string;
314314
readonly name?: string;
315315
readonly bar?: string;
316-
constructor(init: ModelInit<SimpleModel>);
317-
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel>) => MutableModel<SimpleModel> | void): SimpleModel;
316+
constructor(init: ModelInit<SimpleModel, SimpleModelMetaData>);
317+
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel, SimpleModelMetaData>) => MutableModel<SimpleModel, SimpleModelMetaData> | void): SimpleModel;
318318
}"
319319
`);
320320
expect(generateImportSpy).toBeCalledTimes(1);
@@ -325,7 +325,7 @@ describe('Javascript visitor with default owner auth', () => {
325325

326326
expect(generateModelDeclarationSpy).toBeCalledTimes(2);
327327
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(1, (declarationVisitor as any).modelMap['SimpleModel'], true);
328-
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(2, (declarationVisitor as any).nonModelMap['SimpleNonModelType'], true);
328+
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(2, (declarationVisitor as any).nonModelMap['SimpleNonModelType'], true, false);
329329
});
330330
});
331331
});
@@ -386,8 +386,8 @@ describe('Javascript visitor with custom owner field auth', () => {
386386
readonly id: string;
387387
readonly name?: string;
388388
readonly bar?: string;
389-
constructor(init: ModelInit<SimpleModel>);
390-
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel>) => MutableModel<SimpleModel> | void): SimpleModel;
389+
constructor(init: ModelInit<SimpleModel, SimpleModelMetaData>);
390+
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel, SimpleModelMetaData>) => MutableModel<SimpleModel, SimpleModelMetaData> | void): SimpleModel;
391391
}"
392392
`);
393393
expect(generateImportSpy).toBeCalledTimes(1);
@@ -398,7 +398,7 @@ describe('Javascript visitor with custom owner field auth', () => {
398398

399399
expect(generateModelDeclarationSpy).toBeCalledTimes(2);
400400
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(1, (declarationVisitor as any).modelMap['SimpleModel'], true);
401-
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(2, (declarationVisitor as any).nonModelMap['SimpleNonModelType'], true);
401+
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(2, (declarationVisitor as any).nonModelMap['SimpleNonModelType'], true, false);
402402
});
403403
});
404404
});
@@ -461,8 +461,8 @@ describe('Javascript visitor with multiple owner field auth', () => {
461461
readonly id: string;
462462
readonly name?: string;
463463
readonly bar?: string;
464-
constructor(init: ModelInit<SimpleModel>);
465-
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel>) => MutableModel<SimpleModel> | void): SimpleModel;
464+
constructor(init: ModelInit<SimpleModel, SimpleModelMetaData>);
465+
static copyOf(source: SimpleModel, mutator: (draft: MutableModel<SimpleModel, SimpleModelMetaData>) => MutableModel<SimpleModel, SimpleModelMetaData> | void): SimpleModel;
466466
}"
467467
`);
468468
expect(generateImportSpy).toBeCalledTimes(1);
@@ -473,7 +473,7 @@ describe('Javascript visitor with multiple owner field auth', () => {
473473

474474
expect(generateModelDeclarationSpy).toBeCalledTimes(2);
475475
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(1, (declarationVisitor as any).modelMap['SimpleModel'], true);
476-
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(2, (declarationVisitor as any).nonModelMap['SimpleNonModelType'], true);
476+
expect(generateModelDeclarationSpy).toHaveBeenNthCalledWith(2, (declarationVisitor as any).nonModelMap['SimpleNonModelType'], true, false);
477477
});
478478
});
479479
});
@@ -520,8 +520,8 @@ describe('Javascript visitor with auth directives in field level', () => {
520520
readonly name: string;
521521
readonly address: string;
522522
readonly ssn?: string;
523-
constructor(init: ModelInit<Employee>);
524-
static copyOf(source: Employee, mutator: (draft: MutableModel<Employee>) => MutableModel<Employee> | void): Employee;
523+
constructor(init: ModelInit<Employee, EmployeeMetaData>);
524+
static copyOf(source: Employee, mutator: (draft: MutableModel<Employee, EmployeeMetaData>) => MutableModel<Employee, EmployeeMetaData> | void): Employee;
525525
}"
526526
`);
527527

0 commit comments

Comments
 (0)