Skip to content

Instantly share code, notes, and snippets.

@Bharathh-Raj
Last active March 17, 2022 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bharathh-Raj/907f45ab490b1588ea809091d6b9c7f5 to your computer and use it in GitHub Desktop.
Save Bharathh-Raj/907f45ab490b1588ea809091d6b9c7f5 to your computer and use it in GitHub Desktop.
//Note: This code is just for demonstration purpose
void main(){
test("fetch() should return an instance of student on remoteDataSource's fetch success", () {
Repository repo = Repository(MockRemoteDateSourceSuccess());
final result = repo.fetch();
expect(result, isInstanceOf<Student>());
});
test("fetch() should throw an exception on remoteDataSource's fetch throws any exception", () {
Repository repo = Repository(MockRemoteDateSourceFailure());
expect(() => repo.fetch(), throwsException);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment