X-Git-Url: http://git.squeep.com/?p=squeep-indieauth-helper;a=blobdiff_plain;f=test%2Flib%2Fcommunication.js;fp=test%2Flib%2Fcommunication.js;h=a94bf90f6dfed98063916f5500af4430e6d64a34;hp=c79d2613f5388485862a3eb83ef7d84304b8582c;hb=e486f80a4e7a1f65498335e7408f3301c9e7cb44;hpb=786217e7862a4d956c6510c6a171c86ab160fda6 diff --git a/test/lib/communication.js b/test/lib/communication.js index c79d261..a94bf90 100644 --- a/test/lib/communication.js +++ b/test/lib/communication.js @@ -870,7 +870,7 @@ describe('Communication', function () { }); }); // fetchProfile - describe('redeemProfileCode', function () { + describe('redeemCode', function () { let expected, urlObj, code, codeVerifier, clientId, redirectURI; beforeEach(function () { urlObj = new URL('https://example.com/auth'); @@ -887,6 +887,18 @@ describe('Communication', function () { me: 'https://profile.example.com/', }; + const result = await communication.redeemCode(urlObj, code, codeVerifier, clientId, redirectURI); + + assert.deepStrictEqual(result, expected); + }); + it('covers deprecated method name', async function () { + communication.axios.resolves({ + data: '{"me":"https://profile.example.com/"}', + }); + expected = { + me: 'https://profile.example.com/', + }; + const result = await communication.redeemProfileCode(urlObj, code, codeVerifier, clientId, redirectURI); assert.deepStrictEqual(result, expected); @@ -894,11 +906,11 @@ describe('Communication', function () { it('covers failure', async function () { communication.axios.resolves('Not a JSON payload.'); - const result = await communication.redeemProfileCode(urlObj, code, codeVerifier, clientId, redirectURI); + const result = await communication.redeemCode(urlObj, code, codeVerifier, clientId, redirectURI); assert.strictEqual(result, undefined); }); - }); // redeemProfileCode + }); // redeemCode describe('introspectToken', function () { let introspectionUrlObj, authenticationHeader, token; @@ -958,4 +970,4 @@ describe('Communication', function () { }); }); // deliverTicket -}); // Communication \ No newline at end of file +}); // Communication