mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-22 01:43:29 +01:00
scoll indices based on ND sort name for artists
This commit is contained in:
@@ -1,7 +1,57 @@
|
||||
import { v4 as uuid } from "uuid";
|
||||
|
||||
import { anArtist } from "./builders";
|
||||
import { artistToArtistSummary } from "../src/music_service";
|
||||
import { artistToArtistSummary, slice2 } from "../src/music_service";
|
||||
|
||||
|
||||
describe("slice2", () => {
|
||||
const things = ["a", "b", "c", "d", "e", "f", "g", "h", "i"];
|
||||
|
||||
describe("when slice is a subset of the things", () => {
|
||||
it("should return the page", () => {
|
||||
expect(slice2({ _index: 3, _count: 4 })(things)).toEqual([
|
||||
["d", "e", "f", "g"],
|
||||
things.length
|
||||
])
|
||||
});
|
||||
});
|
||||
|
||||
describe("when slice goes off the end of the things", () => {
|
||||
it("should return the page", () => {
|
||||
expect(slice2({ _index: 5, _count: 100 })(things)).toEqual([
|
||||
["f", "g", "h", "i"],
|
||||
things.length
|
||||
])
|
||||
});
|
||||
});
|
||||
|
||||
describe("when no _count is provided", () => {
|
||||
it("should return from the index", () => {
|
||||
expect(slice2({ _index: 5 })(things)).toEqual([
|
||||
["f", "g", "h", "i"],
|
||||
things.length
|
||||
])
|
||||
});
|
||||
});
|
||||
|
||||
describe("when no _index is provided", () => {
|
||||
it("should assume from the start", () => {
|
||||
expect(slice2({ _count: 3 })(things)).toEqual([
|
||||
["a", "b", "c"],
|
||||
things.length
|
||||
])
|
||||
});
|
||||
});
|
||||
|
||||
describe("when no _index or _count is provided", () => {
|
||||
it("should return all the things", () => {
|
||||
expect(slice2()(things)).toEqual([
|
||||
things,
|
||||
things.length
|
||||
])
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("artistToArtistSummary", () => {
|
||||
it("should map fields correctly", () => {
|
||||
|
||||
Reference in New Issue
Block a user