mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
refactor: Change PreferenceSupport constructor to work with Components.js
This commit is contained in:
parent
50dfea1a27
commit
ef6f01a82c
@ -14,8 +14,8 @@ export class PreferenceSupport {
|
|||||||
private readonly preferences: RepresentationPreferences;
|
private readonly preferences: RepresentationPreferences;
|
||||||
private readonly converter: RepresentationConverter;
|
private readonly converter: RepresentationConverter;
|
||||||
|
|
||||||
public constructor(preferences: RepresentationPreferences, converter: RepresentationConverter) {
|
public constructor(type: string, converter: RepresentationConverter) {
|
||||||
this.preferences = preferences;
|
this.preferences = { type: [{ value: type, weight: 1 }]};
|
||||||
this.converter = converter;
|
this.converter = converter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,16 +6,16 @@ import { PreferenceSupport } from '../../../../src/storage/routing/PreferenceSup
|
|||||||
import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
|
import { UnsupportedHttpError } from '../../../../src/util/errors/UnsupportedHttpError';
|
||||||
|
|
||||||
describe('A PreferenceSupport', (): void => {
|
describe('A PreferenceSupport', (): void => {
|
||||||
let preferences: RepresentationPreferences;
|
const type = 'internal/quads';
|
||||||
|
const preferences: RepresentationPreferences = { type: [{ value: type, weight: 1 }]};
|
||||||
let converter: RepresentationConverter;
|
let converter: RepresentationConverter;
|
||||||
let support: PreferenceSupport;
|
let support: PreferenceSupport;
|
||||||
const identifier: ResourceIdentifier = 'identifier' as any;
|
const identifier: ResourceIdentifier = 'identifier' as any;
|
||||||
const representation: Representation = 'representation' as any;
|
const representation: Representation = 'representation' as any;
|
||||||
|
|
||||||
beforeEach(async(): Promise<void> => {
|
beforeEach(async(): Promise<void> => {
|
||||||
preferences = { type: []};
|
|
||||||
converter = { canHandle: jest.fn() } as any;
|
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<void> => {
|
it('returns true if the converter supports the input.', async(): Promise<void> => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user