mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-28 19:01:34 +00:00
29 lines
1.3 KiB
JavaScript
29 lines
1.3 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import test from 'node:test';
|
|
|
|
import {
|
|
resolveSpaceCardFit,
|
|
} from '../test-build/space-geometry.js';
|
|
|
|
test('space-card public config normalises and projects the framing policy once', () => {
|
|
const card = readFileSync(new URL('../src/space-card.ts', import.meta.url), 'utf8');
|
|
assert.match(card, /fit\?: SpaceCardFit/);
|
|
assert.match(card, /fit: resolveSpaceCardFit\(config\.fit\)/);
|
|
assert.match(card, /fit: this\._config\.fit/);
|
|
assert.equal(resolveSpaceCardFit(undefined), 'content');
|
|
assert.equal(resolveSpaceCardFit('content'), 'content');
|
|
assert.equal(resolveSpaceCardFit('house'), 'house');
|
|
assert.equal(resolveSpaceCardFit('cover'), 'content');
|
|
});
|
|
|
|
test('space-card visual editor offers only localised content and house choices', () => {
|
|
const editor = readFileSync(new URL('../src/space-editor.ts', import.meta.url), 'utf8');
|
|
assert.match(editor, /name: 'fit'/);
|
|
assert.match(editor, /value: 'content', label: t\(this\._lang, 'editor\.fit_content'\)/);
|
|
assert.match(editor, /value: 'house', label: t\(this\._lang, 'editor\.fit_house'\)/);
|
|
assert.match(editor, /fit: t\(L, 'editor\.framing'\)/);
|
|
assert.match(editor, /fit: resolveSpaceCardFit\(this\._config\.fit\)/);
|
|
assert.doesNotMatch(editor, /value: 'cover'/);
|
|
});
|