+ describe('living-standard-20220212', function () {
+ it('covers valid profile', async function () {
+ ctx.parsedBody.me = 'https://example.com/profile';
+ manager.indieAuthCommunication.fetchProfile.resolves({
+ metadata: {
+ issuer: 'https://example.com/',
+ authorizationEndpoint: 'https://example.com/auth',
+ },
+ });
+ await manager.postAdminLogin(res, ctx);
+ assert.strictEqual(res.statusCode, 302);
+ });
+ it('covers bad issuer url', async function () {
+ ctx.parsedBody.me = 'https://example.com/profile';
+ manager.indieAuthCommunication.fetchProfile.resolves({
+ metadata: {
+ issuer: 'http://example.com/?bah#foo',
+ authorizationEndpoint: 'https://example.com/auth',
+ },
+ });
+ await manager.postAdminLogin(res, ctx);
+ assert(!res.setHeader.called);
+ });
+ it('covers unparsable issuer url', async function () {
+ ctx.parsedBody.me = 'https://example.com/profile';
+ manager.indieAuthCommunication.fetchProfile.resolves({
+ metadata: {
+ issuer: 'not a url',
+ authorizationEndpoint: 'https://example.com/auth',
+ },
+ });
+ await manager.postAdminLogin(res, ctx);
+ assert(!res.setHeader.called);
+ });
+ }); // living-standard-20220212