Remove tracks function, replace with just getting album

This commit is contained in:
simojenki
2025-02-15 06:48:23 +00:00
parent 7eeedff040
commit 0602e1f077
8 changed files with 242 additions and 419 deletions

View File

@@ -41,6 +41,8 @@ import {
PUNK,
aPlaylist,
aRadioStation,
anArtistSummary,
anAlbumSummary,
} from "./builders";
import { InMemoryMusicService } from "./in_memory_music_service";
import supersoap from "./supersoap";
@@ -2356,10 +2358,8 @@ describe("wsdl api", () => {
});
describe("asking for an album", () => {
const album = anAlbum();
const artist = anArtist({
albums: [album],
});
const album = anAlbumSummary();
const artist = anArtistSummary();
const track1 = aTrack({ artist, album, number: 1 });
const track2 = aTrack({ artist, album, number: 2 });
@@ -2370,7 +2370,12 @@ describe("wsdl api", () => {
const tracks = [track1, track2, track3, track4, track5];
beforeEach(() => {
musicLibrary.tracks.mockResolvedValue(tracks);
musicLibrary.album.mockResolvedValue(anAlbum({
...album,
artistName: artist.name,
artistId: artist.id,
tracks
}));
});
describe("asking for all for an album", () => {
@@ -2394,7 +2399,7 @@ describe("wsdl api", () => {
total: tracks.length,
})
);
expect(musicLibrary.tracks).toHaveBeenCalledWith(album.id);
expect(musicLibrary.album).toHaveBeenCalledWith(album.id);
});
});
@@ -2421,7 +2426,7 @@ describe("wsdl api", () => {
total: tracks.length,
})
);
expect(musicLibrary.tracks).toHaveBeenCalledWith(album.id);
expect(musicLibrary.album).toHaveBeenCalledWith(album.id);
});
});
});