|
@@ -93,6 +93,28 @@ export default function musicCardSnapshotTest() {
|
|
|
expect(binding.artist).assertEqual('Song Artist')
|
|
expect(binding.artist).assertEqual('Song Artist')
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ it('buildMusicCardBindingDataNormalizesEmptyStateWhenNoSong', 0, () => {
|
|
|
|
|
+ const snapshot = createEmptyMusicCardSnapshot()
|
|
|
|
|
+ snapshot.coverPath = '/cover.png'
|
|
|
|
|
+ snapshot.hasCoverImage = true
|
|
|
|
|
+ snapshot.currentPositionMs = 12345
|
|
|
|
|
+ snapshot.durationMs = 67890
|
|
|
|
|
+ snapshot.currentTimeText = '00:12'
|
|
|
|
|
+ snapshot.durationTimeText = '05:01'
|
|
|
|
|
+ snapshot.filePath = '/storage/track.mp3'
|
|
|
|
|
+
|
|
|
|
|
+ const binding = buildMusicCardBindingData(snapshot)
|
|
|
|
|
+
|
|
|
|
|
+ expect(binding.hasSong).assertEqual(false)
|
|
|
|
|
+ expect(binding.coverPath).assertEqual('')
|
|
|
|
|
+ expect(binding.hasCoverImage).assertEqual(false)
|
|
|
|
|
+ expect(binding.currentPositionMs).assertEqual(0)
|
|
|
|
|
+ expect(binding.durationMs).assertEqual(0)
|
|
|
|
|
+ expect(binding.currentTimeText).assertEqual('00:00')
|
|
|
|
|
+ expect(binding.durationTimeText).assertEqual('00:00')
|
|
|
|
|
+ expect(binding.filePath).assertEqual('')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
it('buildMusicCardBindingDataKeepsSourceLyricsWhenAvailable', 0, () => {
|
|
it('buildMusicCardBindingDataKeepsSourceLyricsWhenAvailable', 0, () => {
|
|
|
const snapshot = createEmptyMusicCardSnapshot()
|
|
const snapshot = createEmptyMusicCardSnapshot()
|
|
|
snapshot.hasLyric = true
|
|
snapshot.hasLyric = true
|