Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
feat: Expand test
Browse files Browse the repository at this point in the history
  • Loading branch information
budde377 committed May 12, 2021
1 parent e9ca908 commit 2d98783
Showing 1 changed file with 147 additions and 3 deletions.
150 changes: 147 additions & 3 deletions test/query_generator/fragments/inline_fragments_on_fragments.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,25 @@ void main() {
'Interface fragments',
() async => testGenerator(
query: r'''
fragment InterfaceFragment2 on InterfaceA {
interface {
s
}
...on ImplementationA {
b
}
...on ImplementationB {
i2
}
}
fragment InterfaceFragment on InterfaceA {
s
i
interface {
...InterfaceFragment2
}
...on ImplementationA {
b
}
Expand Down Expand Up @@ -46,6 +62,7 @@ void main() {
interface InterfaceA {
s: String
i: Int
interface: InterfaceA
}
union UnionA = ImplementationA | ImplementationB
Expand Down Expand Up @@ -75,6 +92,56 @@ final LibraryDefinition libraryDefinition =
name: QueryName(name: r'SomeQuery$_Query'),
operationName: r'some_query',
classes: [
ClassDefinition(
name: ClassName(name: r'InterfaceFragment2Mixin$_InterfaceA'),
properties: [
ClassProperty(
type: TypeName(name: r'String'),
name: ClassPropertyName(name: r's'),
isResolveType: false)
],
factoryPossibilities: {},
typeNameField: ClassPropertyName(name: r'__typename'),
isInput: false),
ClassDefinition(
name: ClassName(name: r'InterfaceFragment2Mixin$_ImplementationA'),
properties: [
ClassProperty(
type: TypeName(name: r'bool'),
name: ClassPropertyName(name: r'b'),
isResolveType: false)
],
mixins: [FragmentName(name: r'InterfaceFragment2Mixin')],
factoryPossibilities: {},
typeNameField: ClassPropertyName(name: r'__typename'),
isInput: false),
ClassDefinition(
name: ClassName(name: r'InterfaceFragment2Mixin$_ImplementationB'),
properties: [
ClassProperty(
type: TypeName(name: r'int'),
name: ClassPropertyName(name: r'i2'),
isResolveType: false)
],
mixins: [FragmentName(name: r'InterfaceFragment2Mixin')],
factoryPossibilities: {},
typeNameField: ClassPropertyName(name: r'__typename'),
isInput: false),
FragmentClassDefinition(
name: FragmentName(name: r'InterfaceFragment2Mixin'),
properties: [
ClassProperty(
type: TypeName(name: r'InterfaceFragment2Mixin$_InterfaceA'),
name: ClassPropertyName(name: r'interface'),
annotations: [r'''JsonKey(name: 'interface')'''],
isResolveType: false)
]),
ClassDefinition(
name: ClassName(name: r'InterfaceFragmentMixin$_InterfaceA'),
mixins: [FragmentName(name: r'InterfaceFragment2Mixin')],
factoryPossibilities: {},
typeNameField: ClassPropertyName(name: r'__typename'),
isInput: false),
ClassDefinition(
name: ClassName(name: r'InterfaceFragmentMixin$_ImplementationA'),
properties: [
Expand Down Expand Up @@ -109,6 +176,11 @@ final LibraryDefinition libraryDefinition =
ClassProperty(
type: TypeName(name: r'int'),
name: ClassPropertyName(name: r'i'),
isResolveType: false),
ClassProperty(
type: TypeName(name: r'InterfaceFragmentMixin$_InterfaceA'),
name: ClassPropertyName(name: r'interface'),
annotations: [r'''JsonKey(name: 'interface')'''],
isResolveType: false)
]),
ClassDefinition(
Expand Down Expand Up @@ -178,12 +250,84 @@ import 'package:equatable/equatable.dart';
import 'package:gql/ast.dart';
part 'query.graphql.g.dart';
mixin InterfaceFragment2Mixin {
@JsonKey(name: 'interface')
InterfaceFragment2Mixin$InterfaceA? kw$interface;
}
mixin InterfaceFragmentMixin {
String? s;
int? i;
@JsonKey(name: 'interface')
InterfaceFragmentMixin$InterfaceA? kw$interface;
}
mixin UnionFragmentMixin {}
@JsonSerializable(explicitToJson: true)
class InterfaceFragment2Mixin$InterfaceA extends JsonSerializable
with EquatableMixin {
InterfaceFragment2Mixin$InterfaceA();
factory InterfaceFragment2Mixin$InterfaceA.fromJson(
Map<String, dynamic> json) =>
_$InterfaceFragment2Mixin$InterfaceAFromJson(json);
String? s;
@override
List<Object?> get props => [s];
Map<String, dynamic> toJson() =>
_$InterfaceFragment2Mixin$InterfaceAToJson(this);
}
@JsonSerializable(explicitToJson: true)
class InterfaceFragment2Mixin$ImplementationA extends JsonSerializable
with EquatableMixin, InterfaceFragment2Mixin {
InterfaceFragment2Mixin$ImplementationA();
factory InterfaceFragment2Mixin$ImplementationA.fromJson(
Map<String, dynamic> json) =>
_$InterfaceFragment2Mixin$ImplementationAFromJson(json);
bool? b;
@override
List<Object?> get props => [kw$interface, b];
Map<String, dynamic> toJson() =>
_$InterfaceFragment2Mixin$ImplementationAToJson(this);
}
@JsonSerializable(explicitToJson: true)
class InterfaceFragment2Mixin$ImplementationB extends JsonSerializable
with EquatableMixin, InterfaceFragment2Mixin {
InterfaceFragment2Mixin$ImplementationB();
factory InterfaceFragment2Mixin$ImplementationB.fromJson(
Map<String, dynamic> json) =>
_$InterfaceFragment2Mixin$ImplementationBFromJson(json);
int? i2;
@override
List<Object?> get props => [kw$interface, i2];
Map<String, dynamic> toJson() =>
_$InterfaceFragment2Mixin$ImplementationBToJson(this);
}
@JsonSerializable(explicitToJson: true)
class InterfaceFragmentMixin$InterfaceA extends JsonSerializable
with EquatableMixin, InterfaceFragment2Mixin {
InterfaceFragmentMixin$InterfaceA();
factory InterfaceFragmentMixin$InterfaceA.fromJson(
Map<String, dynamic> json) =>
_$InterfaceFragmentMixin$InterfaceAFromJson(json);
@override
List<Object?> get props => [kw$interface];
Map<String, dynamic> toJson() =>
_$InterfaceFragmentMixin$InterfaceAToJson(this);
}
@JsonSerializable(explicitToJson: true)
class InterfaceFragmentMixin$ImplementationA extends JsonSerializable
with EquatableMixin, InterfaceFragmentMixin {
Expand All @@ -196,7 +340,7 @@ class InterfaceFragmentMixin$ImplementationA extends JsonSerializable
bool? b;
@override
List<Object?> get props => [s, i, b];
List<Object?> get props => [s, i, kw$interface, b];
Map<String, dynamic> toJson() =>
_$InterfaceFragmentMixin$ImplementationAToJson(this);
}
Expand All @@ -213,7 +357,7 @@ class InterfaceFragmentMixin$ImplementationB extends JsonSerializable
int? i2;
@override
List<Object?> get props => [s, i, i2];
List<Object?> get props => [s, i, kw$interface, i2];
Map<String, dynamic> toJson() =>
_$InterfaceFragmentMixin$ImplementationBToJson(this);
}
Expand Down Expand Up @@ -261,7 +405,7 @@ class SomeQuery$Query$InterfaceA extends JsonSerializable
_$SomeQuery$Query$InterfaceAFromJson(json);
@override
List<Object?> get props => [s, i];
List<Object?> get props => [s, i, kw$interface];
Map<String, dynamic> toJson() => _$SomeQuery$Query$InterfaceAToJson(this);
}
Expand Down

0 comments on commit 2d98783

Please sign in to comment.