Initial import: Music_Server, MusicFree, catalog-sync
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { getTrackPlayerOptionPayload } from "./trackPlayerOptions";
|
||||
|
||||
describe("getTrackPlayerOptionPayload", () => {
|
||||
const Capability = {
|
||||
Play: "Play",
|
||||
Pause: "Pause",
|
||||
SkipToNext: "SkipToNext",
|
||||
SkipToPrevious: "SkipToPrevious",
|
||||
Stop: "Stop",
|
||||
SeekTo: "SeekTo",
|
||||
} as const;
|
||||
|
||||
const AppKilledPlaybackBehavior = {
|
||||
ContinuePlayback: "ContinuePlayback",
|
||||
} as const;
|
||||
|
||||
it("keeps the playback service foreground across short track transition gaps", () => {
|
||||
const options = getTrackPlayerOptionPayload(
|
||||
false,
|
||||
Capability,
|
||||
AppKilledPlaybackBehavior,
|
||||
);
|
||||
|
||||
expect(options.android.stopForegroundGracePeriod).toBe(30);
|
||||
expect(options.android.appKilledPlaybackBehavior).toBe(
|
||||
AppKilledPlaybackBehavior.ContinuePlayback,
|
||||
);
|
||||
expect(options.android.alwaysPauseOnInterruption).toBe(false);
|
||||
});
|
||||
|
||||
it("includes stop capability only when exit action is enabled", () => {
|
||||
const withStop = getTrackPlayerOptionPayload(
|
||||
true,
|
||||
Capability,
|
||||
AppKilledPlaybackBehavior,
|
||||
);
|
||||
const withoutStop = getTrackPlayerOptionPayload(
|
||||
false,
|
||||
Capability,
|
||||
AppKilledPlaybackBehavior,
|
||||
);
|
||||
|
||||
expect(withStop.capabilities).toContain(Capability.Stop);
|
||||
expect(withoutStop.capabilities).not.toContain(Capability.Stop);
|
||||
expect(withStop.notificationCapabilities).toContain(Capability.SeekTo);
|
||||
expect(withoutStop.notificationCapabilities).toContain(Capability.SeekTo);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user