Skip to content

Commit

Permalink
test: Native string should not be imported
Browse files Browse the repository at this point in the history
  • Loading branch information
unlight committed Apr 16, 2021
1 parent aba712c commit 2c470f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/helpers/get-graphql-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export function getGraphqlImport(args: {
switch (typeName) {
case 'Float':
case 'Int':
case 'String':
return { name: typeName, specifier: '@nestjs/graphql' };
case 'DateTime':
return { name: 'Date', specifier: undefined };
Expand Down
12 changes: 7 additions & 5 deletions src/test/generate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,13 +496,9 @@ describe('one model with scalar types', () => {

describe('user create input', () => {
before(() => {
sourceFile = project.getSourceFile(s =>
s.getFilePath().endsWith('/user-create.input.ts'),
)!;
setSourceFile('/user-create.input.ts');
});

// it('', () => console.log(sourceFile.getText()));

it('valid imports', () => {
const sourceText = sourceFile.getText();
expect(sourceText).not.toContain("import ';");
Expand Down Expand Up @@ -534,6 +530,12 @@ describe('one model with scalar types', () => {
expect(getFieldType(sourceFile, 'data')).toEqual('() => GraphQLJSON');
});

it('native string should not be imported', () => {
expect(imports).not.toContainEqual(
expect.objectContaining({ name: 'String' }),
);
});

// it('', () => console.log(sourceFile.getText()));
});

Expand Down

0 comments on commit 2c470f8

Please sign in to comment.