Skip to content

Commit

Permalink
test(): fix integration tests, use nullable type
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Jun 18, 2021
1 parent ce3c736 commit 8bd5f2a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions tests/generated-definitions/federation-typedef.fixture.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

/*
* ------------------------------------------------------
* -------------------------------------------------------
* THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
* -------------------------------------------------------
*/
Expand All @@ -24,10 +24,12 @@ export class Post {
}

export abstract class IQuery {
abstract getPosts(): Post[] | Promise<Post[]>;
abstract getPosts(): Nullable<Nullable<Post>[]> | Promise<Nullable<Nullable<Post>[]>>;
}

export class User {
id: string;
posts?: Post[];
posts?: Nullable<Nullable<Post>[]>;
}

type Nullable<T> = T | null;
8 changes: 4 additions & 4 deletions tests/plugin/model-class-visitor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from './fixtures/es5-class.dto';
import {
nullableDtoText,
nullableDtoTextTranspiled
nullableDtoTextTranspiled,
} from './fixtures/nullable.dto';

describe('API model properties', () => {
Expand Down Expand Up @@ -91,11 +91,11 @@ describe('API model properties', () => {

it('should support & understand nullable type unions', () => {
const options: ts.CompilerOptions = {
module: ts.ModuleKind.ESNext,
target: ts.ScriptTarget.ESNext,
module: ts.ModuleKind.ES2020,
target: ts.ScriptTarget.ES2020,
newLine: ts.NewLineKind.LineFeed,
noEmitHelpers: true,
strict: true
strict: true,
};
const filename = 'nullable.input.ts';
const fakeProgram = ts.createProgram([filename], options);
Expand Down

0 comments on commit 8bd5f2a

Please sign in to comment.