|
| 1 | +import data from '../../src/exports/comunica.js'; |
| 2 | + |
| 3 | +jest.unmock('solid-auth-client'); |
| 4 | +import { mockHttp } from '../util'; |
| 5 | + |
| 6 | +const ruben = 'https://ruben.verborgh.org/profile/#me'; |
| 7 | + |
| 8 | +describe('System test: profile', () => { |
| 9 | + mockHttp(); |
| 10 | + |
| 11 | + test('main profile fields', async () => { |
| 12 | + expect(await data[ruben].name).toHaveProperty('value', 'Ruben Verborgh'); |
| 13 | + expect(await data[ruben].givenName).toHaveProperty('value', 'Ruben'); |
| 14 | + expect(await data[ruben].familyName).toHaveProperty('value', 'Verborgh'); |
| 15 | + expect(await data[ruben].email).toHaveProperty('value', 'mailto:ruben.verborgh@ugent.be'); |
| 16 | + }); |
| 17 | + |
| 18 | + test('friend URLs', async () => { |
| 19 | + const friends = []; |
| 20 | + for await (const friend of data[ruben].friends) |
| 21 | + friends.push(`${friend}`); |
| 22 | + expect(friends.length).toBeGreaterThan(100); |
| 23 | + expect(friends).toContain('https://www.w3.org/People/Berners-Lee/card#i'); |
| 24 | + expect(friends).toContain('https://www.rubensworks.net/#me'); |
| 25 | + expect(friends).toContain('https://data.verborgh.org/people/joachim_van_herwegen'); |
| 26 | + }); |
| 27 | + |
| 28 | + test('friend names', async () => { |
| 29 | + const friends = []; |
| 30 | + for await (const friend of data[ruben].friends.givenName) |
| 31 | + friends.push(`${friend}`); |
| 32 | + expect(friends.length).toBeGreaterThan(100); |
| 33 | + expect(friends).toContain('Tim'); |
| 34 | + expect(friends).toContain('Ruben'); |
| 35 | + expect(friends).toContain('Joachim'); |
| 36 | + }); |
| 37 | + |
| 38 | + test('friend names with separate expressions', async () => { |
| 39 | + const friends = []; |
| 40 | + for await (const friend of data[ruben].friends) |
| 41 | + friends.push(`${await friend.givenName}`); |
| 42 | + expect(friends.length).toBeGreaterThan(100); |
| 43 | + expect(friends).toContain('Tim'); |
| 44 | + expect(friends).toContain('Ruben'); |
| 45 | + expect(friends).toContain('Joachim'); |
| 46 | + }); |
| 47 | +}); |
0 commit comments