default indieauth profile entry to https if scheme not specified
[squeep-authentication-module] / test / lib / session-manager.js
index bf8df03b94f8875bfa5306e6f9a59f51546cfbe6..a3efeafce3b812fcfd3961393e4e015a5986afad 100644 (file)
@@ -113,6 +113,21 @@ describe('SessionManager', function () {
       await manager.postAdminLogin(res, ctx);
       assert(!res.setHeader.called);
     });
+    it('covers profile scheme fallback', async function () {
+      ctx.parsedBody.me = 'https://example.com/profile';
+      ctx.parsedBody.me_auto_scheme = '1';
+      manager.indieAuthCommunication.fetchProfile
+        .onCall(0).resolves()
+        .onCall(1).resolves({
+        metadata: {
+          issuer: 'https://example.com/',
+          authorizationEndpoint: 'https://example.com/auth',
+        },
+      });
+      await manager.postAdminLogin(res, ctx);
+      assert.strictEqual(res.statusCode, 302);
+
+    });
     describe('living-standard-20220212', function () {
       it('covers valid profile', async function () {
         ctx.parsedBody.me = 'https://example.com/profile';