Skip to content

Commit

Permalink
test(integration-test/nestjs-integration-test): strict mode friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
nartc committed Jan 31, 2021
1 parent 5178c3c commit b9a6b86
Show file tree
Hide file tree
Showing 46 changed files with 407 additions and 401 deletions.
8 changes: 6 additions & 2 deletions packages/integration-test/src/lib/with-classes/defer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ describe('Defer', () => {
it('should map correctly', () => {
mapper.createMap(SimpleUser, SimpleUserVm).forMember(
(d) => d.fullName,
mapDefer(() => mapFrom((s) => s.firstName + ' ' + s.lastName))
mapDefer(() =>
mapFrom<SimpleUser, SimpleUserVm>((s) => s.firstName + ' ' + s.lastName)
)
);

const user = new SimpleUser();
Expand All @@ -23,7 +25,9 @@ describe('Defer', () => {
mapper.createMap(SimpleUser, SimpleUserVm).forMember(
(d) => d.fullName,
preCondition((s) => s.firstName === 'Phuong'),
mapDefer(() => mapFrom((s) => s.firstName + ' ' + s.lastName))
mapDefer(() =>
mapFrom<SimpleUser, SimpleUserVm>((s) => s.firstName + ' ' + s.lastName)
)
);

const user = new SimpleUser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { AutoMap } from '@automapper/classes';

export class PascalAddress {
@AutoMap()
Street: string;
Street!: string;
@AutoMap()
City: string;
City!: string;
@AutoMap()
State: string;
State!: string;
}

export class PascalAddressVm {
@AutoMap()
FormattedAddress: string;
FormattedAddress!: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { AutoMap } from '@automapper/classes';

export class SnakeAddress {
@AutoMap()
street: string;
street!: string;
@AutoMap()
city: string;
city!: string;
@AutoMap()
state: string;
state!: string;
}

export class SnakeAddressVm {
@AutoMap()
formatted_address: string;
formatted_address!: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { AutoMap } from '@automapper/classes';

export class Address {
@AutoMap()
street: string;
street!: string;
@AutoMap()
city: string;
city!: string;
@AutoMap()
state: string;
state!: string;
}

export class AddressVm {
@AutoMap()
formattedAddress: string;
formattedAddress!: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import { AutoMap } from '@automapper/classes';

export class PascalAvatar {
@AutoMap()
Url: string;
Url!: string;
@AutoMap()
Source: string;
Source!: string;
@AutoMap()
ShouldIgnore: number;
ShouldIgnore!: number;
@AutoMap(() => String)
ShouldBeSubstituted!: string | null;
@AutoMap()
ShouldBeSubstituted: string;
@AutoMap()
ForCondition: boolean;
ForCondition!: boolean;
}

export class PascalAvatarVm {
@AutoMap()
Url: string;
@AutoMap()
WillBeIgnored: number;
Url!: string;
@AutoMap()
ShouldBeSubstituted: string;
WillBeIgnored!: number;
@AutoMap(() => String)
ShouldBeSubstituted!: string | null;
@AutoMap()
ForCondition: boolean;
ForCondition!: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import { AutoMap } from '@automapper/classes';

export class SnakeAvatar {
@AutoMap()
url: string;
url!: string;
@AutoMap()
source: string;
source!: string;
@AutoMap()
should_ignore: number;
should_ignore!: number;
@AutoMap()
should_be_substituted: string;
should_be_substituted!: string;
@AutoMap()
for_condition: boolean;
for_condition!: boolean;
}

export class SnakeAvatarVm {
@AutoMap()
url: string;
url!: string;
@AutoMap()
will_be_ignored: number;
will_be_ignored!: number;
@AutoMap()
should_be_substituted: string;
should_be_substituted!: string;
@AutoMap()
for_condition: boolean;
for_condition!: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ import { AutoMap } from '@automapper/classes';

export class Avatar {
@AutoMap()
url: string;
url!: string;
@AutoMap()
source: string;
source!: string;
@AutoMap()
shouldIgnore: number;
shouldIgnore!: number;
@AutoMap(() => String)
shouldBeSubstituted!: string | null;
@AutoMap()
shouldBeSubstituted: string;
@AutoMap()
forCondition: boolean;
forCondition!: boolean;
}

export class AvatarVm {
@AutoMap()
url: string;
@AutoMap()
willBeIgnored: number;
url!: string;
@AutoMap()
shouldBeSubstituted: string;
willBeIgnored!: number;
@AutoMap(() => String)
shouldBeSubstituted!: string | null;
@AutoMap()
forCondition: boolean;
forCondition!: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { FooWithBar, FooWithBarZeroDepth } from './circular-deps-foo';

export class BarWithFoo {
@AutoMap()
id: string;
id!: string;
@AutoMap(() => FooWithBar, 1)
foo: FooWithBar;
foo!: FooWithBar;
}

export class BarWithFooZeroDepth {
@AutoMap()
id: string;
id!: string;
@AutoMap(() => FooWithBarZeroDepth)
foo: FooWithBarZeroDepth;
foo!: FooWithBarZeroDepth;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { BarWithFoo, BarWithFooZeroDepth } from './circular-deps-bar';

export class FooWithBar {
@AutoMap()
id: string;
id!: string;
@AutoMap(() => BarWithFoo, 1)
bar: BarWithFoo | null;
bar!: BarWithFoo | null;
}

export class FooWithBarZeroDepth {
@AutoMap()
id: string;
id!: string;
@AutoMap(() => BarWithFooZeroDepth)
bar: BarWithFooZeroDepth | null;
bar!: BarWithFooZeroDepth | null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { Job } from './docs-job';

export class Bio {
@AutoMap(() => Job)
job: Job;
birthday: Date;
job!: Job;
birthday!: Date;
@AutoMap()
avatarUrl: string;
avatarUrl!: string;
}

export class BioDto {
@AutoMap()
jobTitle: string;
jobTitle!: string;
@AutoMap()
jobSalary: number;
birthday: string;
jobSalary!: number;
birthday!: string;
@AutoMap()
avatarUrl: string;
avatarUrl!: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AutoMap } from '@automapper/classes';

export class Job {
@AutoMap()
title: string;
title!: string;
@AutoMap()
salary: number;
salary!: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ import { Bio, BioDto } from './docs-bio';

export class User {
@AutoMap()
firstName: string;
firstName!: string;
@AutoMap()
lastName: string;
lastName!: string;
@AutoMap()
username: string;
password: string;
username!: string;
password!: string;
@AutoMap(() => Bio)
bio: Bio;
bio!: Bio;
}

export class UserDto {
@AutoMap()
firstName: string;
firstName!: string;
@AutoMap()
lastName: string;
fullName: string;
lastName!: string;
fullName!: string;
@AutoMap()
username: string;
username!: string;
@AutoMap(() => BioDto)
bio: BioDto;
bio!: BioDto;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { AutoMap } from '@automapper/classes';

export class Doctor {
@AutoMap()
name: string;
name!: string;
@AutoMap()
titleTags: string[];
titleTags!: string[];
}

export class DoctorDto {
@AutoMap()
name: string;
name!: string;
@AutoMap()
titleTags: string[];
titleTags!: string[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AutoMap } from '@automapper/classes';

export class PascalJob {
@AutoMap()
Title: string;
Title!: string;
@AutoMap()
AnnualSalary: number;
AnnualSalary!: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AutoMap } from '@automapper/classes';

export class SnakeJob {
@AutoMap()
title: string;
title!: string;
@AutoMap()
annual_salary: number;
annual_salary!: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AutoMap } from '@automapper/classes';

export class Job {
@AutoMap()
title: string;
title!: string;
@AutoMap()
annualSalary: number;
annualSalary!: number;
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
export class NoMetadataBar {
bar: string;
bar!: string;
}

export class NoMetadataFoo {
foo: string;
bar: NoMetadataBar;
foo!: string;
bar!: NoMetadataBar;
}

export class NoMetadataBarDto {
bar: string;
bar!: string;
}

export class NoMetadataFooDto {
foo: string;
bar: NoMetadataBarDto;
foo!: string;
bar!: NoMetadataBarDto;
}
Loading

0 comments on commit b9a6b86

Please sign in to comment.