lukepighetti / mastodon_dart

Unofficial 🐘 client written in 🎯
https://pub.dev/packages/mastodon_dart
MIT License
28 stars 8 forks source link

Tests #8

Closed lukepighetti closed 4 years ago

lukepighetti commented 5 years ago

This is a big topic. The general concept seems to be:

  1. Get a real JSON response (Postman is useful here)
  2. Remove any personal data.
  3. Create an HTTP Override https://docs.flutter.io/flutter/dart-io/HttpOverrides-class.html
  4. Mock a response to the endpoint you're testing. (JSON in a string literal?)
  5. Call the method that hits that endpoint
  6. Make sure the data class deserializes without errors.
  7. Check a couple fields.