CommunitySolidServer/test/unit/storage/Conditions.test.ts
Joachim Van Herwegen b3da9c9fcf refactor: Restructure source code folder
This way the location of certain classes should make more sense
2021-10-12 12:51:02 +02:00

18 lines
725 B
TypeScript

import { RepresentationMetadata } from '../../../src/http/representation/RepresentationMetadata';
import { getETag } from '../../../src/storage/Conditions';
import { DC } from '../../../src/util/Vocabularies';
describe('Conditions', (): void => {
describe('#getETag', (): void => {
it('creates an ETag based on the date last modified.', async(): Promise<void> => {
const now = new Date();
const metadata = new RepresentationMetadata({ [DC.modified]: now.toISOString() });
expect(getETag(metadata)).toBe(`"${now.getTime()}"`);
});
it('returns undefined if no date was found.', async(): Promise<void> => {
expect(getETag(new RepresentationMetadata())).toBeUndefined();
});
});
});