mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
cb2150f33c
ref https://linear.app/tryghost/issue/MOM-108/ap-phase-two Added a WIP version of the Ghost-to-Ghost ActivityPub feature behind the feature flag. Enabling it will add a new item to the main sidebar nav that lets you interact with our ActivityPub mock API in the following ways: - Shows you the list of sites you follow - Shows you the list of sites that follow you - Shows you the articles published by sites you follow - Shows you activities (who followed you or liked your article) - Shows your liked articles Mock API can be easily updated to simulate working with different types of data and interactions.
37 lines
959 B
TypeScript
37 lines
959 B
TypeScript
import getUsername from '../../../src/utils/get-username';
|
|
|
|
describe('getUsername', function () {
|
|
it('returns the formatted username', async function () {
|
|
const user = {
|
|
preferredUsername: 'index',
|
|
id: 'https://www.platformer.news/'
|
|
};
|
|
|
|
const result = getUsername(user);
|
|
|
|
expect(result).toBe('@index@www.platformer.news');
|
|
});
|
|
|
|
it('returns a default username if the user object is missing data', async function () {
|
|
const user = {
|
|
preferredUsername: '',
|
|
id: ''
|
|
};
|
|
|
|
const result = getUsername(user);
|
|
|
|
expect(result).toBe('@unknown@unknown');
|
|
});
|
|
|
|
it('returns a default username if url parsing fails', async function () {
|
|
const user = {
|
|
preferredUsername: 'index',
|
|
id: 'not-a-url'
|
|
};
|
|
|
|
const result = getUsername(user);
|
|
|
|
expect(result).toBe('@unknown@unknown');
|
|
});
|
|
});
|