const assert = require('node:assert/strict'); const Profile = require('../js/profile-store'); const regions = [['北京市', ['北京市']], ['浙江省', ['杭州市', '宁波市']]]; const now = new Date(2026, 9, 12); const user = { id: 'fixture-a', kind: 'wechat' }, other = { id: 'fixture-b', kind: 'wechat' }; const valid = { birth: '1991-11', gender: '男', region: { province: '浙江省', city: '宁波市' }, skinIndex: 3 }; const empty = { birth: '', gender: '', region: null, skinIndex: 0 }; assert.equal(Profile.age(valid.birth, now), 34); assert.equal(Profile.age(valid.birth, new Date(2026, 10, 1)), 35); assert.equal(Profile.age(valid.birth, new Date(2027, 9, 1)), 35); for (const birth of [null, '', '1991-1', '1991-00', '1991-13', '1991-11-01', '2026-01', '2027-01', '1926-01']) { assert.equal(Profile.age(birth, now), null, String(birth)); } assert.equal(Profile.age('2025-10', now), 1); assert.equal(Profile.age('1926-11', now), 99); assert.deepEqual(Profile.clean(null, regions, 5, now), empty); assert.deepEqual(Profile.clean({ ...valid, token: 'not-persisted', report: {} }, regions, 5, now), valid); assert.deepEqual(Profile.clean({ birth: 'bad', gender: '