Add automatic nearby discovery and simplify device presence UI

This commit is contained in:
2026-10-12 17:53:10 +09:00
parent 7e9bb1ec36
commit 5f431ee153
23 changed files with 1148 additions and 106 deletions

View File

@@ -0,0 +1,37 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { readDeviceInfo } from '../../web/src/deviceInfo.js';
test('모델 힌트가 없거나 거절된 브라우저도 정상 연결할 수 있다', async () => {
assert.deepEqual(await readDeviceInfo({}), { model: '', platform: '', manufacturer: '' });
assert.deepEqual(
await readDeviceInfo({
userAgentData: {
getHighEntropyValues: async () => {
throw Error('withheld');
},
},
}),
{},
);
});
test('Android 모델을 구분하고 브라우저 브랜드를 제조사로 사용하지 않는다', async () => {
const nav = {
userAgentData: {
getHighEntropyValues: async (hints) => {
assert.deepEqual(hints, ['model']);
return { model: 'SM-S938B', platform: 'Android', brands: [{ brand: 'Chrome' }] };
},
},
};
assert.deepEqual(await readDeviceInfo(nav), {
model: 'SM-S938B',
platform: 'Android',
manufacturer: 'Samsung',
});
nav.userAgentData.getHighEntropyValues = async () => ({
model: 'Unknown phone',
platform: 'Android',
});
assert.equal((await readDeviceInfo(nav)).manufacturer, '');
});