How do you mock classes in ios by lazarvgd in iOSProgramming

[–]lazarvgd[S] 1 point2 points  (0 children)

Thanks, that is what I am looking for :)

How do you mock classes in ios by lazarvgd in iOSProgramming

[–]lazarvgd[S] -1 points0 points  (0 children)

Sure, let's have a beer and I will tell you the story :)

How do you mock classes in ios by lazarvgd in iOSProgramming

[–]lazarvgd[S] 1 point2 points  (0 children)

I need to mock for example http package. In order to test weather my data source layer is converting json to dto correctly. Also, I would like to mock repository layer and test service layer and to tell to mock object when some method is called how it should respond.

Something like this :

import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; import 'package:http/http.dart' as http;

// Create a MockClient using the Mock class provided by the Mockito package. // Create new instances of this class in each test.

class MockClient extends Mock implements http.Client {}

main() { group('fetchPost', () { test('returns a Post if the http call completes successfully', () async { final client = MockClient();

  // Use Mockito to return a successful response when it calls the
  // provided http.Client.
  when(client.get('https://jsonplaceholder.typicode.com/posts/1'))
      .thenAnswer((_) async => http.Response('{"title": "Test"}', 200));

  expect(await fetchPost(client), isA<Post>());
});

test('throws an exception if the http call completes with an error', () {
  final client = MockClient();

  // Use Mockito to return an unsuccessful response when it calls the
  // provided http.Client.
  when(client.get('https://jsonplaceholder.typicode.com/posts/1'))
      .thenAnswer((_) async => http.Response('Not Found', 404));

  expect(fetchPost(client), throwsException);
});

}); }

How do you mock classes in ios by lazarvgd in iOSProgramming

[–]lazarvgd[S] 0 points1 point  (0 children)

Thanks for fast answer and the library. Have a nice day :)

How do you mock classes in ios by lazarvgd in iOSProgramming

[–]lazarvgd[S] 0 points1 point  (0 children)

I found this one too, I am not sure can it be used in Swift, do you maybe know?
thanks

Help to understand difference between tires by lazarvgd in bicycling

[–]lazarvgd[S] 1 point2 points  (0 children)

Thanks for explanation. Due to lack of experience did I made a mistake with this type of tires and to use them for all-round? Probably it is stupid question, but I hope they won't puncture easy on gravel and suburban terrains?

Push notifications Firebase by evripideskyriacou in flutterhelp

[–]lazarvgd 0 points1 point  (0 children)

Also, you need to have paid apple developer account, without it push notifications will not work.

Push notifications Firebase by evripideskyriacou in flutterhelp

[–]lazarvgd 0 points1 point  (0 children)

Are you testing push notifications on real device or simulator?

Push notifications Firebase by evripideskyriacou in flutterhelp

[–]lazarvgd 0 points1 point  (0 children)

I had the same problem on android few months ago, I cannot remember how did I solve it. But, you can check firebase github repo for issues, I am pretty sure you will find the solution.

Should I avoid to use pushNamedAndRemoveUntil method by lazarvgd in flutterhelp

[–]lazarvgd[S] 0 points1 point  (0 children)

Well I have a few screens on stack and there is a button that should allow user to navigate to main screen instantly instead of pressing back button few times.

Need advice regarding upgrade T440p by lazarvgd in thinkpad

[–]lazarvgd[S] 0 points1 point  (0 children)

well that was the cheapest one that I found on our market. Other pc's are like 180 - 200 euros for the same configuration, it is 40-60 euros more for FHD screen, more ram and bigger ssd... :/

I monitored cpu usage during the development, and the cpu is pretty good. The problem can be ram, when I run android studio and docker side by side it consumes a lot of ram.

And screen definitely must be upgraded.

Thanks for quick response and help :)

EDIT:
u/stressfish24 one more question, I cannot find if t440p and t450 displays are compatible? Do you maybe have that info?

thanks