You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.5 KiB
81 lines
2.5 KiB
import 'package:eaimar/data/models/agent_module.dart';
|
|
import 'package:eaimar/data/services/agent_module_service.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
// 车载香薰连上时铺的那三个
|
|
const carAroma = ['smartcarChat', 'fieldRecording', 'meeting'];
|
|
const defaults = ['call', 'simultaneous', 'meeting', 'fieldRecording'];
|
|
|
|
group('isLayoutMigrationArtifact', () {
|
|
// 这正是 2026-09-14 线上那台机的状态:香薰编排铺过 3 项,
|
|
// 重启后被 _migrateDefaultLayout 把默认全量追加到尾部,
|
|
// 于是基线对不上、从此再也不按设备铺编排。
|
|
test('设备编排被追加了默认项 → 认得出来', () {
|
|
expect(
|
|
AgentModuleService.isLayoutMigrationArtifact(
|
|
enabled: [...carAroma, 'call', 'simultaneous'],
|
|
lastApplied: carAroma,
|
|
defaults: defaults,
|
|
),
|
|
isTrue,
|
|
);
|
|
});
|
|
|
|
test('用户把设备编排里的项删掉/换过顺序 → 不是迁移造成的,不能碰', () {
|
|
expect(
|
|
AgentModuleService.isLayoutMigrationArtifact(
|
|
enabled: ['fieldRecording', 'smartcarChat', 'meeting', 'call'],
|
|
lastApplied: carAroma,
|
|
defaults: defaults,
|
|
),
|
|
isFalse,
|
|
);
|
|
});
|
|
|
|
test('多出来的项不在默认全量里(用户从广场加的)→ 不认', () {
|
|
expect(
|
|
AgentModuleService.isLayoutMigrationArtifact(
|
|
enabled: [...carAroma, 'pictureTranslation'],
|
|
lastApplied: carAroma,
|
|
defaults: defaults,
|
|
),
|
|
isFalse,
|
|
);
|
|
});
|
|
|
|
test('编排与基线完全一致 → 没被追加过', () {
|
|
expect(
|
|
AgentModuleService.isLayoutMigrationArtifact(
|
|
enabled: carAroma,
|
|
lastApplied: carAroma,
|
|
defaults: defaults,
|
|
),
|
|
isFalse,
|
|
);
|
|
});
|
|
|
|
test('从没自动铺过(基线为空)→ 不认', () {
|
|
expect(
|
|
AgentModuleService.isLayoutMigrationArtifact(
|
|
enabled: [...carAroma, 'call'],
|
|
lastApplied: const [],
|
|
defaults: defaults,
|
|
),
|
|
isFalse,
|
|
);
|
|
});
|
|
});
|
|
|
|
// 设备编排的内容本身也守一下:香薰就该是这三个,别被顺手改掉。
|
|
test('车载香薰的默认编排是 Smartcar / 现场录音 / 语音纪要', () {
|
|
expect(
|
|
AgentModules.defaultsForCategory('carAroma'),
|
|
[
|
|
AgentModules.smartcarChat,
|
|
AgentModules.fieldRecording,
|
|
AgentModules.meeting,
|
|
],
|
|
);
|
|
});
|
|
}
|
|
|