test for SongModel.toMediaItem
This commit is contained in:
parent
13edbcefd2
commit
306c9ec6f3
1 changed files with 34 additions and 0 deletions
|
@ -1,3 +1,4 @@
|
|||
import 'package:audio_service/audio_service.dart';
|
||||
import 'package:flutter_audio_query/flutter_audio_query.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
@ -63,6 +64,39 @@ void main() {
|
|||
);
|
||||
});
|
||||
|
||||
group('toMediaItem', () {
|
||||
test(
|
||||
'should return valid MediaItem',
|
||||
() async {
|
||||
// arrange
|
||||
final expected = MediaItem(
|
||||
id: PATH_3,
|
||||
title: SONG_TITLE_3,
|
||||
album: ALBUM_TITLE_3,
|
||||
artist: ARTIST_3,
|
||||
artUri: ALBUM_ART_PATH_3,
|
||||
);
|
||||
|
||||
final songModel = SongModel(
|
||||
album: ALBUM_TITLE_3,
|
||||
artist: ARTIST_3,
|
||||
title: SONG_TITLE_3,
|
||||
path: PATH_3,
|
||||
albumArtPath: ALBUM_ART_PATH_3,
|
||||
trackNumber: TRACKNUMBER_3,
|
||||
);
|
||||
// act
|
||||
final result = songModel.toMediaItem();
|
||||
// assert
|
||||
expect(result.album, expected.album);
|
||||
expect(result.artist, expected.artist);
|
||||
expect(result.title, expected.title);
|
||||
expect(result.id, expected.id);
|
||||
expect(result.artUri, expected.artUri);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
group('fromMoorSong', () {
|
||||
test(
|
||||
'should create valid SongModel',
|
||||
|
|
Loading…
Add table
Reference in a new issue