mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(hooks): handle pkc rebrand regressions
This commit is contained in:
@@ -7,6 +7,8 @@ describe('buildEditableAccountJson', () => {
|
||||
id: 'abc',
|
||||
name: 'Account 1',
|
||||
author: { address: '0x123', shortAddress: '0x1...3', avatar: { url: 'https://example.com' } },
|
||||
pkc: { someOption: true },
|
||||
pkcReactOptions: { foo: 'baz' },
|
||||
plebbit: { someOption: true },
|
||||
karma: 42,
|
||||
plebbitReactOptions: { foo: 'bar' },
|
||||
@@ -17,6 +19,8 @@ describe('buildEditableAccountJson', () => {
|
||||
expect(result.account.name).toBe('Account 1');
|
||||
expect(result.account.author.address).toBe('0x123');
|
||||
expect(result.account.author.avatar).toBeUndefined();
|
||||
expect(result.account.pkc).toBeUndefined();
|
||||
expect(result.account.pkcReactOptions).toBeUndefined();
|
||||
expect(result.account.plebbit).toBeUndefined();
|
||||
expect(result.account.karma).toBeUndefined();
|
||||
expect(result.account.plebbitReactOptions).toBeUndefined();
|
||||
|
||||
@@ -50,6 +50,18 @@ describe('challenge-utils', () => {
|
||||
expect(alertMock).toHaveBeenCalledWith('Error from unknown-board.eth: first error second error');
|
||||
});
|
||||
|
||||
it('uses communityAddress when the upgraded publication no longer exposes subplebbitAddress', () => {
|
||||
alertChallengeVerificationFailed(
|
||||
{
|
||||
challengeErrors: ['first error'],
|
||||
challengeSuccess: false,
|
||||
} as never,
|
||||
{ communityAddress: 'business-and-finance.bso' },
|
||||
);
|
||||
|
||||
expect(alertMock).toHaveBeenCalledWith('Error from /biz/: first error');
|
||||
});
|
||||
|
||||
it('warns about invalid challenge error payloads and falls back to an unknown error', () => {
|
||||
alertChallengeVerificationFailed(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user