Skip to content

Commit

Permalink
*this is why test coverage is important
Browse files Browse the repository at this point in the history
  • Loading branch information
mclark4386 committed Sep 17, 2018
1 parent 00e5547 commit a1af577
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/aad_calls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class FlutterAAD {
}

var rtoken = refresh_token;
if (tok == null || tok == "") {
if (rtoken == null || rtoken == "") {
rtoken = this.currentRefreshToken;
if (rtoken == "") {
if (onError != null) {
Expand Down
18 changes: 18 additions & 0 deletions test/flutter_aad_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,24 @@ void main() {

expect((await aad_logged_out.GetListItems("https://test.site", "Title")),
null); //can't refresh if not logged in
expect(
(await aad_logged_out.GetListItems("https://test.site", "Title",
onError: (msg) {
expect(msg, "No access token passed and saved full token is empty.");
})),
null);
expect(
(await aad_logged_out.GetListItems("https://test.site", "Title",
token: "token", onError: (msg) {
expect(msg, "No refresh token passed and saved full token is empty.");
})),
null);
expect(
(await aad_logged_out.GetListItems("https://test.site", "Title",
token: "bad_token", refresh_token: "bad_token", onError: (msg) {
expect(msg, "bad client id");
})),
null);
expect(
(await aad.GetListItems(
"https://test.site",
Expand Down

0 comments on commit a1af577

Please sign in to comment.