Link-and-sync

This commit is contained in:
Fedor Indutny 2024-10-18 10:15:03 -07:00 committed by GitHub
parent 455ff88918
commit 6565daa5c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 388 additions and 59 deletions

View file

@ -98,16 +98,40 @@ describe('signalRoutes', () => {
check(`sgnl://joingroup#${fooNoSlash}`, result);
});
it('linkDevice', () => {
it('linkDevice without capabilities', () => {
const result: ParsedSignalRoute = {
key: 'linkDevice',
args: { uuid: foo, pubKey: foo },
args: { uuid: foo, pubKey: foo, capabilities: [] },
};
const check = createCheck({ hasWebUrl: false });
check(`sgnl://linkdevice/?uuid=${foo}&pub_key=${foo}`, result);
check(`sgnl://linkdevice?uuid=${foo}&pub_key=${foo}`, result);
});
it('linkDevice with one capability', () => {
const result: ParsedSignalRoute = {
key: 'linkDevice',
args: { uuid: foo, pubKey: foo, capabilities: ['backup'] },
};
const check = createCheck({ hasWebUrl: false });
check(
`sgnl://linkdevice/?uuid=${foo}&pub_key=${foo}&capabilities=backup`,
result
);
});
it('linkDevice with multiple capabilities', () => {
const result: ParsedSignalRoute = {
key: 'linkDevice',
args: { uuid: foo, pubKey: foo, capabilities: ['a', 'b'] },
};
const check = createCheck({ hasWebUrl: false });
check(
`sgnl://linkdevice/?uuid=${foo}&pub_key=${foo}&capabilities=a%2Cb`,
result
);
});
it('captcha', () => {
const captchaId =
'signal-hcaptcha.Foo-bAr_baz.challenge.fOo-bAR_baZ.fOO-BaR_baz';