feat: integrate platform room entry, UI migration and erqiwang documentation
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {readInviteClipboard,readClipboardText} from '../../YouleNexus/assets/framework/adapters/native/invite-clipboard.ts';
|
||||
test('invite paste keeps native signatures and strips non-digits without truncating',async()=>{
|
||||
const calls:unknown[]=[];
|
||||
assert.equal(await readInviteClipboard({kind:'settings',read:(...args:unknown[])=>{calls.push(args);return '码00 1234567';}}),'001234567');
|
||||
assert.deepEqual(calls,[[]]);
|
||||
assert.equal(await readInviteClipboard({kind:'bridge',call:(name,data,cb)=>{assert.equal(name,'gamepastetext');assert.equal(data,'');cb('00-12');}}),'0012');
|
||||
assert.equal(await readInviteClipboard({kind:'browser',read:async()=>'A123'}),'123');
|
||||
await assert.rejects(readInviteClipboard({kind:'settings',read:()=>null}),/clipboard/);
|
||||
});
|
||||
|
||||
test('redemption paste preserves letters, punctuation, whitespace and leading zeroes',async()=>{
|
||||
for(const text of ['00Ab-12',' aB ','']){
|
||||
assert.equal(await readClipboardText({kind:'settings',read:()=>text}),text);
|
||||
assert.equal(await readClipboardText({kind:'bridge',call:(name,data,cb)=>{assert.equal(name,'gamepastetext');assert.equal(data,'');cb(text);}}),text);
|
||||
assert.equal(await readClipboardText({kind:'browser',read:async()=>text}),text);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {OwnedRoomHistory} from '../../YouleNexus/assets/framework/adapters/native/owned-room-history.ts';
|
||||
test('owned rooms use legacy cache, order, and server outcome lifecycle',()=>{
|
||||
const data=new Map<string,string>();const history=new OwnedRoomHistory({getItem:k=>data.get(k)??null,setItem:(k,v)=>{data.set(k,v);}},'g','a');
|
||||
assert.deepEqual(history.read(),[]);assert.equal(data.get('tsgame_roomlist_ga'),'{{}}'.replace('{{}}','{"data":[]}'));
|
||||
history.exited({isowner:1,roomcode:'123456'},0);history.exited({isowner:1,roomcode:'654321'},0);
|
||||
history.exited({isowner:1,roomcode:'123456'},0);assert.deepEqual(history.read(),[654321,123456]);
|
||||
history.exited({isowner:0,roomcode:333333},0);history.exited({isowner:1,roomcode:333333},1);assert.equal(history.read().length,2);
|
||||
history.joined({state:2,roomcode:123456});assert.equal(history.read().length,2);
|
||||
history.joined({state:99,roomcode:123456});assert.deepEqual(history.read(),[654321]);
|
||||
history.joined({state:0,isowner:1,roomcode:654321});assert.deepEqual(history.read(),[]);
|
||||
data.set('tsgame_roomlist_ga','bad');assert.throws(()=>history.read());
|
||||
});
|
||||
Reference in New Issue
Block a user