feat: Implement enhanced user profiles with social features including direct messaging, post comments, and reposts, and introduce new routing for Docs and Changelog views.

This commit is contained in:
2026-01-18 13:10:12 +01:00
parent 959b453d69
commit 62280265b4
23 changed files with 1826 additions and 458 deletions

View File

@@ -0,0 +1,63 @@
const io = require('socket.io-client');
const assert = require('chai').assert;
describe('Social Features (RT & Profile)', function () {
this.timeout(5000);
let client;
const testWallet = 'social_test_wallet_' + Date.now();
before((done) => {
client = io('http://localhost:3000');
client.on('connect', () => {
client.emit('join', { walletAddress: testWallet, username: 'SocialUser' });
done();
});
});
after(() => {
client.disconnect();
});
it('should update profile bio and banner', (done) => {
const updateData = {
walletAddress: testWallet,
bio: 'New bio content',
bannerColor: '#ff0000'
};
client.emit('updateProfile', updateData);
client.on('profileUpdated', (data) => {
assert.equal(data.bio, 'New bio content');
assert.equal(data.bannerColor, '#ff0000');
done();
});
});
it('should create a post and then repost it', (done) => {
client.emit('createPost', { walletAddress: testWallet, content: 'Social Post' });
client.once('postCreated', (post) => {
assert.equal(post.content, 'Social Post');
const postId = post.id;
client.emit('repost', { postId, walletAddress: testWallet });
client.on('postReposted', (repostData) => {
assert.equal(repostData.postId, postId);
assert.equal(repostData.walletAddress, testWallet);
done();
});
});
});
it('should fetch profile with correct post counts', (done) => {
client.emit('getProfile', testWallet);
client.on('profileData', (data) => {
assert.equal(data.wallet_address, testWallet);
assert.isArray(data.posts);
// The post we just created should have a repost count of 1
const post = data.posts.find(p => p.content === 'Social Post');
assert.exists(post);
assert.equal(post.repost_count, 1);
done();
});
});
});