Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
Something went wrong. Try again.
949 B · 31 lines
TypeScript
1234567891011121314151617181920212223242526272829303132import { setupServer, SetupServer } from 'msw/node';import { NodeNetworkErrorCode, NodeNetworkException } from "../../common/errors/NodeErrors.js";
export class MockNetworkError extends Error implements NodeNetworkException {
code: NodeNetworkErrorCode; errno?: number;
constructor(code: string, errno?: number, message?: string) { super(message); this.code = code as NodeNetworkErrorCode; this.errno = errno; }}
/** * Adapted from https://github.com/nock/nock/issues/2397#issuecomment-1591090893 * */
export type ServerOptions = Parameters<typeof setupServer>;
export const withRequestInterception = (handlers: ServerOptions, test: (server: SetupServer) => any) => async () => { const server = setupServer(...handlers); server.listen();
return Promise.resolve(test(server)).finally(() => { server.resetHandlers(); server.close(); });};