+ sinon.stub(communication, 'fetchJSON');
+ });
+ describe('legacy without indieauth-metadata', function () {
+ it('covers', async function () {
+ communication.axios.resolves(response);
+ expected = {
+ name: 'Thuza',
+ photo: 'https://thuza.ratfeathers.com/image.png',
+ url: 'https://thuza.ratfeathers.com/',
+ email: undefined,
+ authorizationEndpoint: 'https://ia.squeep.com/auth',
+ tokenEndpoint: 'https://ia.squeep.com/token',
+ metadata: {
+ authorizationEndpoint: 'https://ia.squeep.com/auth',
+ tokenEndpoint: 'https://ia.squeep.com/token',
+ },
+ };
+ result = await communication.fetchProfile(urlObj);
+ assert.deepStrictEqual(result, expected);
+ });
+ it('covers multiple hCards', async function () {
+ response.data = testData.multiMF2Html;
+ communication.axios.resolves(response);
+ expected = {
+ email: undefined,
+ name: 'Thuza',
+ photo: 'https://thuza.ratfeathers.com/image.png',
+ url: 'https://thuza.ratfeathers.com/',
+ authorizationEndpoint: 'https://ia.squeep.com/auth',
+ tokenEndpoint: 'https://ia.squeep.com/token',
+ metadata: {
+ authorizationEndpoint: 'https://ia.squeep.com/auth',
+ tokenEndpoint: 'https://ia.squeep.com/token',
+ },
+ };
+ result = await communication.fetchProfile(urlObj);
+ assert.deepStrictEqual(result, expected);
+ });
+ it('covers failed fetch', async function () {
+ communication.axios.rejects();
+ expected = {
+ email: undefined,
+ name: undefined,
+ photo: undefined,
+ url: undefined,
+ metadata: {},
+ };
+ result = await communication.fetchProfile(urlObj);
+ assert.deepStrictEqual(result, expected);
+ });