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.
52 lines
1.7 KiB
52 lines
1.7 KiB
import 'package:eaimar/data/models/user_Info.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
/// 「设备页显示了两个 MAC」这个 bug 的回归测试(2026-09-11)。
|
|
///
|
|
/// 真机上车载香薰绑定后,服务端回的是
|
|
/// `"devicemac":"A9:1A:B3:21:E4:DD","license":"A9:1A:B3:21:E4:DD"` ——
|
|
/// 授权码就是 MAC 本身(后台「导入 MAC」模式建的记录,`code := devicemac`)。
|
|
/// 界面照显示就会出现两行一模一样的串:一行钥匙图标(授权码)、一行 MAC,
|
|
/// 看着像同一个 MAC 显示了两遍。
|
|
void main() {
|
|
UserDevice make({required String mac, required String license}) => UserDevice(
|
|
id: 1,
|
|
uid: '1',
|
|
productid: 45345,
|
|
devicetype: 0,
|
|
devicename: 'Smartcar',
|
|
devicemac: mac,
|
|
license: license,
|
|
cmei: '',
|
|
);
|
|
|
|
group('UserDevice.hasRealLicense', () {
|
|
test('授权码就是 MAC 本身 → 不展示(真机原始数据)', () {
|
|
expect(
|
|
make(mac: 'A9:1A:B3:21:E4:DD', license: 'A9:1A:B3:21:E4:DD')
|
|
.hasRealLicense,
|
|
isFalse,
|
|
);
|
|
});
|
|
|
|
test('大小写与分隔符不同也算同一个值', () {
|
|
expect(make(mac: 'A9:1A:B3:21:E4:DD', license: 'a91ab321e4dd').hasRealLicense,
|
|
isFalse);
|
|
expect(make(mac: 'A9:1A:B3:21:E4:DD', license: 'A9-1A-B3-21-E4-DD')
|
|
.hasRealLicense, isFalse);
|
|
});
|
|
|
|
test('真授权码照常展示', () {
|
|
expect(
|
|
make(mac: 'A9:1A:B3:21:E4:DD', license: '71E5E5C3A797C043B5A7')
|
|
.hasRealLicense,
|
|
isTrue,
|
|
);
|
|
});
|
|
|
|
test('空授权码不展示', () {
|
|
expect(make(mac: 'A9:1A:B3:21:E4:DD', license: ' ').hasRealLicense,
|
|
isFalse);
|
|
});
|
|
});
|
|
}
|
|
|