Skip to content

Commit

Permalink
build: upgrade android version
Browse files Browse the repository at this point in the history
  • Loading branch information
cevheri committed Nov 10, 2024
1 parent 41f9cea commit 8b23d56
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions test/data/model/user_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import 'package:flutter_bloc_advance/main/main_local.mapper.g.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
final DateTime createdDate = DateTime(2024, 1, 1);
late User userModel;
User initUser() {
final createdDate = DateTime.now();
return User(
id: '1',
login: 'test_login',
Expand Down Expand Up @@ -44,9 +44,9 @@ void main() {
expect(finalUser.activated, true);
expect(finalUser.langKey, 'en');
expect(finalUser.createdBy, 'admin');
expect(finalUser.createdDate, DateTime(2021, 1, 1));
expect(finalUser.createdDate, createdDate);
expect(finalUser.lastModifiedBy, 'admin');
expect(finalUser.lastModifiedDate, DateTime(2021, 1, 2));
expect(finalUser.lastModifiedDate, createdDate);
expect(finalUser.authorities, ['ROLE_USER']);
});

Expand All @@ -66,14 +66,15 @@ void main() {
expect(updatedUser.activated, true);
expect(updatedUser.langKey, 'en');
expect(updatedUser.createdBy, 'admin');
expect(updatedUser.createdDate, DateTime(2021, 1, 1));
expect(updatedUser.createdDate, createdDate);
expect(updatedUser.lastModifiedBy, 'admin');
expect(updatedUser.lastModifiedDate, DateTime(2021, 1, 2));
expect(updatedUser.lastModifiedDate, createdDate);
expect(updatedUser.authorities, ['ROLE_USER']);
});

test('should deserialize from JSON', () {
const json = {
final createdDateString = createdDate.toIso8601String();
final json = {
'id': '1',
'login': 'test_login',
'firstName': 'John',
Expand All @@ -82,9 +83,9 @@ void main() {
'activated': true,
'langKey': 'en',
'createdBy': 'admin',
'createdDate': '2021-01-01T00:00:00.000Z',
'createdDate': createdDateString,
'lastModifiedBy': 'admin',
'lastModifiedDate': '2021-01-02T00:00:00.000Z',
'lastModifiedDate': createdDateString,
'authorities': ['ROLE_USER'],
};

Expand All @@ -98,16 +99,17 @@ void main() {
expect(finalUser?.activated, true);
expect(finalUser?.langKey, 'en');
expect(finalUser?.createdBy, 'admin');
expect(finalUser?.createdDate, DateTime.parse('2021-01-01T00:00:00.000Z'));
expect(finalUser?.createdDate, createdDate);
expect(finalUser?.lastModifiedBy, 'admin');
expect(finalUser?.lastModifiedDate, DateTime.parse('2021-01-02T00:00:00.000Z'));
expect(finalUser?.lastModifiedDate, createdDate);
expect(finalUser?.authorities, ['ROLE_USER']);
});

test('should deserialize from JSON string', () {
//postUserJson = await rootBundle.loadString(mockDataPath+postUserMockData);

const jsonString = '''
final createdDateString = createdDate.toIso8601String();
final jsonString = '''
{
"id": "1",
"login": "test_login",
Expand All @@ -117,9 +119,9 @@ void main() {
"activated": true,
"langKey": "en",
"createdBy": "admin",
"createdDate": "2021-01-01T00:00:00.000Z",
"createdDate": "$createdDateString",
"lastModifiedBy": "admin",
"lastModifiedDate": "2021-01-02T00:00:00.000Z",
"lastModifiedDate": "$createdDateString",
"authorities": ["ROLE_USER"]
}
''';
Expand All @@ -134,9 +136,9 @@ void main() {
expect(finalUser?.activated, true);
expect(finalUser?.langKey, 'en');
expect(finalUser?.createdBy, 'admin');
expect(finalUser?.createdDate, DateTime.parse('2021-01-01T00:00:00.000Z'));
expect(finalUser?.createdDate, createdDate);
expect(finalUser?.lastModifiedBy, 'admin');
expect(finalUser?.lastModifiedDate, DateTime.parse('2021-01-02T00:00:00.000Z'));
expect(finalUser?.lastModifiedDate, createdDate);
expect(finalUser?.authorities, ['ROLE_USER']);
});
});
Expand Down

0 comments on commit 8b23d56

Please sign in to comment.