21 lines
579 B
Dart
21 lines
579 B
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:tm_app/core/utils/date_utils.dart';
|
|
|
|
void main() {
|
|
group('timeConvertor', () {
|
|
test('returns dash for null and zero', () {
|
|
expect(timeConvertor(null), '-');
|
|
expect(timeConvertor(0), '-');
|
|
});
|
|
|
|
test('formats unix seconds like moment.unix', () {
|
|
expect(timeConvertor(1700000000), '2023-11-14');
|
|
});
|
|
|
|
test('parses string timestamps from json', () {
|
|
expect(unixTimestampFromJson('1700000000'), 1700000000);
|
|
expect(unixTimestampFromJson(''), isNull);
|
|
});
|
|
});
|
|
}
|