-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update MiscService.getApiStatus to v2 (#393)
* v1 has been deleted Co-authored-by: Rob Becker <[email protected]>
- Loading branch information
1 parent
7bc0667
commit 741c26d
Showing
6 changed files
with
131 additions
and
23 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,37 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:github/src/common.dart'; | ||
import 'package:http/http.dart'; | ||
import 'package:http/testing.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
void main() { | ||
MiscService create(Future<Response> Function(Request) f) { | ||
final client = MockClient(f); | ||
final github = GitHub(client: client); | ||
return MiscService(github); | ||
} | ||
|
||
test('api status', () async { | ||
final miscService = create( | ||
(_) async => Response(''' | ||
{ | ||
"page":{ | ||
"id":"kctbh9vrtdwd", | ||
"name":"GitHub", | ||
"url":"https://www.githubstatus.com", | ||
"updated_at": "2023-11-29T08:03:04Z" | ||
}, | ||
"status": { | ||
"description": "Partial System Outage", | ||
"indicator": "major" | ||
} | ||
}''', HttpStatus.ok), | ||
); | ||
final status = await miscService.getApiStatus(); | ||
expect(status.page, isNotNull); | ||
expect(status.page?.id, 'kctbh9vrtdwd'); | ||
expect(status.status, isNotNull); | ||
expect(status.status?.indicator, 'major'); | ||
}); | ||
} |