Skip to content
This repository was archived by the owner on Aug 9, 2024. It is now read-only.

Feat/jackson cuevas test #13

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

jcuevashub
Copy link

Hello everyone,

I wanted to inform you about an update to the test. Due to my oversight regarding Yelp's API daily request limits, I had to make a slight modification to the original plan. Additionally, for a bit of enjoyment, I decided to utilize path_provider for storing favorite restaurants. Although I initially thought that shared_preferences would be simple to implement, I opted for using a JSON file for data storage as a more engaging approach.

Should you require any clarification or have questions about these changes, please don't hesitate to reach out.

Thank you.

…G CHANGE: I need to remove the homePage with the Fetch button because I reached the limit from Yelp GraphQL API.
… strings BREAKING CHANGE: I removed the default theme design from the project
… I didn’t know the yelp had limit request.
…rieval each time the user switches tabs. Additionally, a RefreshIndicator has been integrated to facilitate the updating of in-memory data.
import 'dart:io';
import 'package:path_provider/path_provider.dart';

import '../../../models/restaurant.dart';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
"Review text goes here. Review text goes here. Review text goes here. This is a review. This is a review. This is a review that is 4 lines long."),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: you're not using the reviewText

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right. The property doesn't exist, which explains the current situation. However, let me explore what options I have to circumvent the use of hard-coded text.

itemBuilder: (context, index) {
var review = widget.restaurant.reviews![index];
return ReviewListTile(
stars: review.rating!,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're force unwrapping here, not properly cheking for nullable values

pubspec.yaml Outdated
@@ -10,13 +10,19 @@ environment:
sdk: ">=2.12.0 <3.0.0"

dependencies:
integration_test:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a dev dependency

pubspec.yaml Outdated

gap: ^3.0.1
stacked: ^3.4.2
mockito: ^5.4.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mockito is a dev dependency

import 'package:restaurantour/models/restaurant.dart';
import 'package:restaurantour/repositories/yelp_repository.dart';

class MockYelpRepository extends Mock implements YelpRepository {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snake_case naming convention also applies to tests

}

ready() async {
isLoading = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: seems like this viewmodel is not needed, what do you think?

final result = await yelpRepo.getRestaurants();
return result!.restaurants!;
} catch (e) {
throw Exception(e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: who catches this exception?

onViewModelReady: (RestaurantViewModel viewModel) => viewModel.ready(),
builder: (context, RestaurantViewModel viewModel, child) =>
FutureBuilder<List<Restaurant>>(
future: viewModel.fetchData(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're making new reuqests each time we come back from the favorites tab, any idea how to persist these?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants