chore: sync local workspace changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { mergeDefaultChatTypes } from './app-config-service.js';
|
||||
import { mergeDefaultChatTypes, resolveAppConfigByOrigin } from './app-config-service.js';
|
||||
|
||||
test('mergeDefaultChatTypes preserves saved edits for built-in chat types', () => {
|
||||
const merged = mergeDefaultChatTypes([
|
||||
@@ -39,6 +39,24 @@ test('mergeDefaultChatTypes preserves saved edits for layout editor execution',
|
||||
assert.equal(layoutEditorExecution.description, '호출 가능한 API 요청만 처리합니다.');
|
||||
});
|
||||
|
||||
test('mergeDefaultChatTypes preserves saved edits for guided layout editor execution', () => {
|
||||
const merged = mergeDefaultChatTypes([
|
||||
{
|
||||
id: 'layout-editor-guided-execution',
|
||||
name: 'Layout editor 단계별 실행',
|
||||
description: '사용자가 정리한 단계별 Layout 실행 문맥',
|
||||
permissions: ['token-user'],
|
||||
enabled: true,
|
||||
updatedAt: '2026-05-01T09:00:00.000Z',
|
||||
},
|
||||
]);
|
||||
|
||||
const guidedLayoutEditorExecution = merged.find((item) => item.id === 'layout-editor-guided-execution');
|
||||
|
||||
assert.ok(guidedLayoutEditorExecution);
|
||||
assert.equal(guidedLayoutEditorExecution.description, '사용자가 정리한 단계별 Layout 실행 문맥');
|
||||
});
|
||||
|
||||
test('mergeDefaultChatTypes still appends missing built-in chat types', () => {
|
||||
const merged = mergeDefaultChatTypes([]);
|
||||
|
||||
@@ -46,4 +64,51 @@ test('mergeDefaultChatTypes still appends missing built-in chat types', () => {
|
||||
assert.ok(merged.some((item) => item.id === 'layout-editor-execution'));
|
||||
assert.ok(merged.some((item) => item.id === 'api-request-template'));
|
||||
assert.ok(merged.some((item) => item.id === 'general-inquiry'));
|
||||
assert.ok(!merged.some((item) => item.id === 'layout-editor-guided-execution'));
|
||||
});
|
||||
|
||||
test('resolveAppConfigByOrigin prefers scoped app config over legacy global config', () => {
|
||||
const resolved = resolveAppConfigByOrigin(
|
||||
{
|
||||
chat: {
|
||||
maxContextMessages: 12,
|
||||
receiveRoomNotifications: true,
|
||||
},
|
||||
automation: {
|
||||
notifyOnAutomationStart: true,
|
||||
},
|
||||
scopedAppConfigs: {
|
||||
'https://rel.sm-home.cloud': {
|
||||
config: {
|
||||
chat: {
|
||||
receiveRoomNotifications: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
'https://rel.sm-home.cloud',
|
||||
) as {
|
||||
chat?: { maxContextMessages?: number; receiveRoomNotifications?: boolean };
|
||||
automation?: { notifyOnAutomationStart?: boolean };
|
||||
};
|
||||
|
||||
assert.equal(resolved.chat?.maxContextMessages, 12);
|
||||
assert.equal(resolved.chat?.receiveRoomNotifications, false);
|
||||
assert.equal(resolved.automation?.notifyOnAutomationStart, true);
|
||||
});
|
||||
|
||||
test('resolveAppConfigByOrigin falls back to legacy global config when scoped config is missing', () => {
|
||||
const resolved = resolveAppConfigByOrigin(
|
||||
{
|
||||
chat: {
|
||||
receiveRoomNotifications: true,
|
||||
},
|
||||
},
|
||||
'https://test.sm-home.cloud',
|
||||
) as {
|
||||
chat?: { receiveRoomNotifications?: boolean };
|
||||
};
|
||||
|
||||
assert.equal(resolved.chat?.receiveRoomNotifications, true);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user