diff --git a/src/storage/routing/PreferenceSupport.ts b/src/storage/routing/PreferenceSupport.ts index 67d1c1d7a..164834631 100644 --- a/src/storage/routing/PreferenceSupport.ts +++ b/src/storage/routing/PreferenceSupport.ts @@ -14,8 +14,8 @@ export class PreferenceSupport { private readonly preferences: RepresentationPreferences; private readonly converter: RepresentationConverter; - public constructor(preferences: RepresentationPreferences, converter: RepresentationConverter) { - this.preferences = preferences; + public constructor(type: string, converter: RepresentationConverter) { + this.preferences = { type: [{ value: type, weight: 1 }]}; this.converter = converter; } diff --git a/test/unit/storage/routing/PreferenceSupport.test.ts b/test/unit/storage/routing/PreferenceSupport.test.ts index 4498e3f53..4a8ecb3ee 100644 --- a/test/unit/storage/routing/PreferenceSupport.test.ts +++ b/test/unit/storage/routing/PreferenceSupport.test.ts @@ -6,16 +6,16 @@ import { PreferenceSupport } from '../../../../src/storage/routing/PreferenceSup import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError'; describe('A PreferenceSupport', (): void => { - let preferences: RepresentationPreferences; + const type = 'internal/quads'; + const preferences: RepresentationPreferences = { type: [{ value: type, weight: 1 }]}; let converter: RepresentationConverter; let support: PreferenceSupport; const identifier: ResourceIdentifier = 'identifier' as any; const representation: Representation = 'representation' as any; beforeEach(async(): Promise => { - preferences = { type: []}; converter = { canHandle: jest.fn() } as any; - support = new PreferenceSupport(preferences, converter); + support = new PreferenceSupport(type, converter); }); it('returns true if the converter supports the input.', async(): Promise => {