A decentralized music tracking and discovery platform built on AT Protocol 🎵

webscrobbler: add more tests

+81
+81
crates/webscrobbler/src/types.rs
··· 791 791 let result = serde_json::from_str::<ScrobbleRequest>(json); 792 792 assert!(result.is_ok(), "Failed to parse JSON: {:?}", result.err()); 793 793 } 794 + 795 + #[test] 796 + fn test_deezer_scrobble_request() { 797 + let json = r#" 798 + { 799 + "eventName": "nowplaying", 800 + "time": 1747899797294, 801 + "data": { 802 + "song": { 803 + "parsed": { 804 + "track": "Exile Is A Habit", 805 + "artist": "Fox Stevenson", 806 + "albumArtist": null, 807 + "album": "Sunk Cost Fallacy", 808 + "duration": 261, 809 + "uniqueID": "3382194151", 810 + "currentTime": null, 811 + "isPlaying": true, 812 + "trackArt": "https://cdn-images.dzcdn.net/images/cover/f8f25df28395fcc1b036982ad1475737/500x500.jpg", 813 + "isPodcast": false, 814 + "originUrl": "https://www.deezer.com/en/album/761728451", 815 + "scrobblingDisallowedReason": null 816 + }, 817 + "processed": { 818 + "track": "Exile Is A Habit", 819 + "artist": "Fox Stevenson", 820 + "albumArtist": null, 821 + "album": "Sunk Cost Fallacy", 822 + "duration": 258 823 + }, 824 + "noRegex": { 825 + "track": "Exile Is A Habit", 826 + "artist": "Fox Stevenson", 827 + "albumArtist": null, 828 + "album": "Sunk Cost Fallacy", 829 + "duration": null 830 + }, 831 + "flags": { 832 + "isScrobbled": false, 833 + "isCorrectedByUser": false, 834 + "isRegexEditedByUser": { 835 + "track": false, 836 + "artist": false, 837 + "album": false, 838 + "albumArtist": false 839 + }, 840 + "isAlbumFetched": false, 841 + "isValid": true, 842 + "isMarkedAsPlaying": false, 843 + "isSkipped": false, 844 + "isReplaying": false, 845 + "hasBlockedTag": false, 846 + "isLovedInService": null, 847 + "finishedProcessing": true 848 + }, 849 + "metadata": { 850 + "startTimestamp": 1754673593, 851 + "label": "Deezer", 852 + "trackArtUrl": "https://lastfm.freetls.fastly.net/i/u/300x300/b3eee782a80469085b2105fc63f0e534.png", 853 + "artistUrl": "https://www.last.fm/music/Fox+Stevenson", 854 + "trackUrl": "https://www.last.fm/music/Fox+Stevenson/_/Exile+Is+A+Habit", 855 + "albumUrl": "https://www.last.fm/music/Fox+Stevenson/Exile+Is+A+Habit", 856 + "userPlayCount": 0 857 + }, 858 + "connector": { 859 + "label": "Deezer", 860 + "matches": [ 861 + "*://www.deezer.com/*" 862 + ], 863 + "js": "deezer.js", 864 + "id": "deezer" 865 + }, 866 + "controllerTabId": 2105807456 867 + } 868 + } 869 + } 870 + "#; 871 + 872 + let result = serde_json::from_str::<ScrobbleRequest>(json); 873 + assert!(result.is_ok(), "Failed to parse JSON: {:?}", result.err()); 874 + } 794 875 }