Skip to content

Commit

Permalink
more test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
acao committed Nov 12, 2022
1 parent cfa5e8f commit 8989ffc
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .changeset/orange-timers-worry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'graphql-language-service-server': patch
'graphql-language-service-cli': patch
'monaco-graphql': patch
---

use decorators-legacy @babel/parser plugin so that all styles of decorator usage
are supported
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,30 @@ query Test {
expect(contents[0].template).toEqual(` query {} `);
});

it('finds queries with modern & legacy decorators', async () => {
it('finds queries with es7 decorators', async () => {
const text = `
import { Module } from 'example/common';
import { GraphQLModule } from 'example/graphql';
class C {
state = {isLoading: true}
@enumerable(false)
method() {}
@something
onChange() {}
}
// 'legacy-decorators' does'nt like this this. thus why the modes are incompatible
class MyClass1 extends Component {
state = {isLoading: true}
@something
onChange() {}
@something()
handleSubmit() {}
}
@isTestable(true)
class MyClass {}
@Module({
imports: [
Expand All @@ -173,10 +193,17 @@ query Test {
],
})
class A {}
@Decorator.a.b()
class Todo {}
@Decorator.d().e
class Todo2{}
@a
export class AppModule {}
class AppModule {}
const query = graphql\` query {} \`
`;
const contents = findGraphQLTags(text, '.ts');

Expand Down

0 comments on commit 8989ffc

Please sign in to comment.