Skip to content

Commit dd22044

Browse files
committed
Explain a GitHub sign-in that cannot reach GitHub
Closes #1057
1 parent d239acd commit dd22044

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎src/settings-onboarding-page.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import test from 'node:test';
2+
import assert from 'node:assert/strict';
3+
import {runInNewContext} from 'node:vm';
4+
import {SERVICE_SCRIPT} from '../src/settings-onboarding-page.js';
5+
test('GitHub sign-in explains that GitHub could not be reached',async()=>{
6+
const nodes=new Map();const get=id=>{if(!nodes.has(id))nodes.set(id,{value:'https://cards.example',hidden:true,setAttribute(k,v){this[k]=v},addEventListener(k,fn){this[k]=fn},replaceChildren(){}});return nodes.get(id)};
7+
runInNewContext(SERVICE_SCRIPT,{document:{getElementById:get},fetch:async path=>path==='/api/settings/services'?{ok:true,json:async()=>({spotify:null,hosted:{url:'https://cards.example'}})}:{ok:false,json:async()=>({status:'unreachable'})},performance:{now:()=>0},setTimeout(){}});
8+
await new Promise(r=>setImmediate(r));await get('hosted-connect').click();
9+
assert.equal(get('hosted-service-result').textContent,'GitHub sign-in could not start: Could not reach GitHub. Check your connection and try again.');
10+
});

0 commit comments

Comments
 (0)