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.
1.4 kB · 46 lines
TypeScript
12345678910111213141516171819202122232425262728293031323334353637383940414243444546import { expect } from 'chai';import { UpstreamError } from '../../common/errors/UpstreamError.ts';import { serializeError, deserializeError } from 'serialize-error';import { AbortedError } from '../../common/errors/MSErrors.ts';
describe('#ErrorMarshalling', function() {
it('serializes custom error with name',function() {
const up = new UpstreamError('a test upstream');
const s = serializeError(up); expect(s.name).eq('UpstreamError'); });
it('deserializes custom error',function() {
const up = new UpstreamError('a test upstream', {showStopper: true});
const s = serializeError(up); const e = deserializeError(s);
expect(e).instanceOf(UpstreamError); expect((e as UpstreamError).showStopper).eq(true);
const a = new AbortedError('aborted test'); const aMarshalled = deserializeError(serializeError(a)); expect(aMarshalled).instanceOf(AbortedError); });
it('deserializes custom nested error',function() {
const sourceError = new Error('a test', {cause: new UpstreamError('a test upstream', {showStopper: true})});
const s = serializeError(sourceError); const e = deserializeError(s);
expect(e.cause).instanceOf(UpstreamError); expect((e.cause as UpstreamError).showStopper).eq(true); });
});