Skip to content

Commit 46dac29

Browse files
committed
Explain an expired Spotify sign-in
Closes #1043
1 parent c2cfde8 commit 46dac29

2 files changed

Lines changed: 13 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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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('Spotify OAuth expiry explains that sign-in can be retried',async()=>{
6+
let feedback='',cleared=false,loaded=false;
7+
const context={spotifyFlow:'fixture-flow',spotifyGeneration:1,clearSpotifyLink(){cleared=true},say(id,text){assert.equal(id,'spotify-service-result');feedback=text},api:async()=>({status:'failed',error:'expired'}),async load(){loaded=true}};
8+
const start=SERVICE_SCRIPT.indexOf('async function pollSpotify('),end=SERVICE_SCRIPT.indexOf("$('spotify-remove').addEventListener",start);
9+
runInNewContext(SERVICE_SCRIPT.slice(start,end),context);await context.pollSpotify(1);
10+
assert.equal(feedback,'Spotify sign-in failed: Sign-in expired. Click Sign in with Spotify to start again.');
11+
assert.equal(context.spotifyFlow,null);assert.equal(cleared,true);assert.equal(loaded,false);
12+
});

0 commit comments

Comments
 (0)