-
-
Notifications
You must be signed in to change notification settings - Fork 626
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #443 from jayjun/from
feat(client): support joining multiple links at once
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'package:graphql/src/link/link.dart'; | ||
import 'package:graphql/src/link/operation.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
group('link', () { | ||
test('multiple', () { | ||
String result = ''; | ||
|
||
final link1 = Link( | ||
request: (Operation op, [NextLink forward]) { | ||
result += '1'; | ||
return null; | ||
}, | ||
); | ||
|
||
final link2 = Link( | ||
request: (Operation op, [NextLink forward]) { | ||
result += '2'; | ||
return null; | ||
}, | ||
); | ||
|
||
final link3 = Link( | ||
request: (Operation op, [NextLink forward]) { | ||
result += '3'; | ||
return null; | ||
}, | ||
); | ||
|
||
expect( | ||
execute( | ||
link: Link.from([link1, link2, link3]), | ||
operation: null, | ||
), | ||
null, | ||
); | ||
|
||
expect(result, '123'); | ||
}); | ||
}); | ||
} |