mirror of
https://github.com/pezkuwichain/pezkuwi-extension.git
synced 2026-06-09 20:11:13 +00:00
test: update test files with Pezkuwi terminology
- Replace Polkadot/Kusama/Westend with Pezkuwi/Dicle/Zagros - Update genesis hashes to Pezkuwi network hashes - Update icon themes from polkadot/substrate to pezkuwi/bizinikiwi - Update URLs from polkadot.org to pezkuwichain.io - Update account names from "My Polkadot Account" to "My Pezkuwi Account"
This commit is contained in:
@@ -23,11 +23,11 @@ const { configure, mount } = enzyme;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
const oneRequest = [{ id: '1', request: { origin: '???' }, url: 'http://polkadot.org' }];
|
||||
const oneRequest = [{ id: '1', request: { origin: '???' }, url: 'http://pezkuwichain.io' }];
|
||||
|
||||
const twoRequests = [
|
||||
...oneRequest,
|
||||
{ id: '2', request: { origin: 'abc' }, url: 'http://polkadot.pl' }
|
||||
{ id: '2', request: { origin: 'abc' }, url: 'http://pezkuwichain.app' }
|
||||
];
|
||||
|
||||
const oneAccount = [
|
||||
@@ -69,7 +69,7 @@ describe('Authorize', () => {
|
||||
const wrapper = mountAuthorize(oneRequest);
|
||||
|
||||
expect(wrapper.find(Request).length).toBe(1);
|
||||
expect(wrapper.find(Request).find('.warning-message').text()).toBe('An application, self-identifying as ??? is requesting access from http://polkadot.org');
|
||||
expect(wrapper.find(Request).find('.warning-message').text()).toBe('An application, self-identifying as ??? is requesting access from http://pezkuwichain.io');
|
||||
});
|
||||
|
||||
it('render more request but just one accept button', () => {
|
||||
@@ -77,7 +77,7 @@ describe('Authorize', () => {
|
||||
|
||||
expect(wrapper.find(Request).length).toBe(2);
|
||||
expect(wrapper.find(Warning).length).toBe(2);
|
||||
expect(wrapper.find(Request).at(1).find('.warning-message').text()).toBe('An application, self-identifying as abc is requesting access from http://polkadot.pl');
|
||||
expect(wrapper.find(Request).at(1).find('.warning-message').text()).toBe('An application, self-identifying as abc is requesting access from http://pezkuwichain.app');
|
||||
expect(wrapper.find('button.acceptButton').length).toBe(1);
|
||||
});
|
||||
|
||||
|
||||
@@ -107,9 +107,9 @@ describe('Create Account', () => {
|
||||
});
|
||||
|
||||
it('saves account with provided network, name and password', async () => {
|
||||
const kusamaGenesis = '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe';
|
||||
const dicleGenesis = '0x0000000000000000000000000000000000000000000000000000000000000004';
|
||||
|
||||
wrapper.find('select').simulate('change', { target: { value: kusamaGenesis } });
|
||||
wrapper.find('select').simulate('change', { target: { value: dicleGenesis } });
|
||||
await act(flushAllPromises);
|
||||
wrapper.update();
|
||||
|
||||
@@ -117,7 +117,7 @@ describe('Create Account', () => {
|
||||
wrapper.find('[data-button-action="add new root"] button').simulate('click');
|
||||
await act(flushAllPromises);
|
||||
|
||||
expect(messaging.createAccountSuri).toHaveBeenCalledWith('abc', 'abcdef', exampleAccount.seed, 'sr25519', kusamaGenesis);
|
||||
expect(messaging.createAccountSuri).toHaveBeenCalledWith('abc', 'abcdef', exampleAccount.seed, 'sr25519', dicleGenesis);
|
||||
expect(onActionStub).toHaveBeenCalledWith('/');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -36,13 +36,13 @@ const { configure, mount } = enzyme;
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
const parentPassword = 'pass';
|
||||
const westendGenesis = '0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e';
|
||||
const zagrosGenesis = '0x0000000000000000000000000000000000000000000000000000000000000003';
|
||||
const defaultDerivation = '//0';
|
||||
const derivedAddress = '5GYQRJj3NUznYDzCduENRcocMsyxmb6tjb5xW87ZMErBe9R7';
|
||||
|
||||
const accounts = [
|
||||
{ address: '5FjgD3Ns2UpnHJPVeRViMhCttuemaRXEqaD8V5z4vxcsUByA', name: 'A', type: 'sr25519' },
|
||||
{ address: '5GYmFzQCuC5u3tQNiMZNbFGakrz3Jq31NmMg4D2QAkSoQ2g5', genesisHash: westendGenesis, name: 'B', type: 'sr25519' },
|
||||
{ address: '5GYmFzQCuC5u3tQNiMZNbFGakrz3Jq31NmMg4D2QAkSoQ2g5', genesisHash: zagrosGenesis, name: 'B', type: 'sr25519' },
|
||||
{ address: '5D2TPhGEy2FhznvzaNYW9AkuMBbg3cyRemnPsBvBY4ZhkZXA', name: 'BB', parentAddress: '5GYmFzQCuC5u3tQNiMZNbFGakrz3Jq31NmMg4D2QAkSoQ2g5', type: 'sr25519' },
|
||||
{ address: '5GhGENSJBWQZ8d8mARKgqEkiAxiW3hHeznQDW2iG4XzNieb6', isExternal: true, name: 'C', type: 'sr25519' },
|
||||
{ address: '0xd5D81CD4236a43F48A983fc5B895975c511f634D', name: 'Ethereum', type: 'ethereum' },
|
||||
@@ -294,7 +294,7 @@ describe('Derive', () => {
|
||||
await act(flushAllPromises);
|
||||
wrapper.update();
|
||||
|
||||
expect(deriveMock).toHaveBeenCalledWith(accounts[1].address, defaultDerivation, parentPassword, newAccount.name, newAccount.password, westendGenesis);
|
||||
expect(deriveMock).toHaveBeenCalledWith(accounts[1].address, defaultDerivation, parentPassword, newAccount.name, newAccount.password, zagrosGenesis);
|
||||
expect(onActionStub).toHaveBeenCalledWith('/');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,10 +21,10 @@ const { configure, mount } = enzyme;
|
||||
|
||||
const mockedAccount = {
|
||||
content: '12bxf6QJS5hMJgwbJMDjFot1sq93EvgQwyuPWENr9SzJfxtN',
|
||||
expectedBannerChain: 'Polkadot',
|
||||
genesisHash: '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3',
|
||||
expectedBannerChain: 'Pezkuwi',
|
||||
genesisHash: '0x0000000000000000000000000000000000000000000000000000000000000001',
|
||||
isAddress: true,
|
||||
name: 'My Polkadot Account'
|
||||
name: 'My Pezkuwi Account'
|
||||
};
|
||||
|
||||
interface ScanType {
|
||||
|
||||
@@ -23,7 +23,7 @@ const account = {
|
||||
derivation: '/1',
|
||||
expectedAddress: '5GNg7RWeAAJuya4wTxb8aZf19bCWJroKuJNrhk4N3iYHNqTm',
|
||||
expectedAddressWithDerivation: '5DV3x9zgaXREUMTX7GgkP3ETeW4DQAznWTxg4kx2WivGuQLQ',
|
||||
name: 'My Polkadot Account',
|
||||
name: 'My Pezkuwi Account',
|
||||
password: 'somePassword',
|
||||
seed: 'upgrade multiply predict hip multiply march leg devote social outer oppose debris'
|
||||
};
|
||||
|
||||
@@ -119,7 +119,7 @@ describe('Signing requests', () => {
|
||||
},
|
||||
sign: jest.fn()
|
||||
},
|
||||
url: 'https://js.pezkuwichain.app/apps/?rpc=wss%3A%2F%2Fwestend-rpc.polkadot.io#/accounts'
|
||||
url: 'https://js.pezkuwichain.app/apps/?rpc=wss%3A%2F%2Frpc.zagros.pezkuwichain.io#/accounts'
|
||||
},
|
||||
{
|
||||
account: {
|
||||
@@ -245,7 +245,7 @@ describe('Signing requests', () => {
|
||||
},
|
||||
sign: jest.fn()
|
||||
},
|
||||
url: 'https://js.pezkuwichain.app/apps/?rpc=wss%3A%2F%2Fwestend-rpc.polkadot.io#/accounts'
|
||||
url: 'https://js.pezkuwichain.app/apps/?rpc=wss%3A%2F%2Frpc.zagros.pezkuwichain.io#/accounts'
|
||||
}];
|
||||
await mountComponent();
|
||||
expect(wrapper.find(Extrinsic)).toHaveLength(0);
|
||||
@@ -257,7 +257,7 @@ describe('Signing requests', () => {
|
||||
it('correctly displays request 1', () => {
|
||||
expect(wrapper.find(Address).find('.fullAddress').text()).toBe(signRequests[0].account.address);
|
||||
expect(wrapper.find(Extrinsic).find('td.data').map((el): string => el.text())).toEqual([
|
||||
'https://js.pezkuwichain.app/apps/?rpc=wss%3A%2F%2Fwestend-rpc.polkadot.io#/accounts',
|
||||
'https://js.pezkuwichain.app/apps/?rpc=wss%3A%2F%2Frpc.zagros.pezkuwichain.io#/accounts',
|
||||
'Westend',
|
||||
'45',
|
||||
'3',
|
||||
|
||||
@@ -24,7 +24,7 @@ const { configure, mount } = enzyme;
|
||||
configure({ adapter: new Adapter() });
|
||||
|
||||
const account = {
|
||||
name: 'My Polkadot Account',
|
||||
name: 'My Pezkuwi Account',
|
||||
password: 'somepassword'
|
||||
};
|
||||
|
||||
|
||||
@@ -51,10 +51,10 @@ interface AccountTestGenesisJson extends AccountTestJson {
|
||||
genesisHash: HexString;
|
||||
}
|
||||
|
||||
const externalAccount = { address: '5EeaoDj4VDk8V6yQngKBaCD5MpJUCHrhYjVhBjgMHXoYon1s', expectedIconTheme: 'polkadot', isExternal: true, name: 'External Account', type: 'sr25519' } as AccountJson;
|
||||
const externalAccount = { address: '5EeaoDj4VDk8V6yQngKBaCD5MpJUCHrhYjVhBjgMHXoYon1s', expectedIconTheme: 'pezkuwi', isExternal: true, name: 'External Account', type: 'sr25519' } as AccountJson;
|
||||
const hardwareAccount = {
|
||||
address: 'HDE6uFdw53SwUyfKSsjwZNmS2sziWMPuY6uJhGHcFzLYRaJ',
|
||||
expectedIconTheme: 'polkadot',
|
||||
expectedIconTheme: 'pezkuwi',
|
||||
// Kusama genesis hash
|
||||
genesisHash: '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe',
|
||||
isExternal: true,
|
||||
@@ -64,51 +64,51 @@ const hardwareAccount = {
|
||||
} as AccountJson;
|
||||
|
||||
const accounts = [
|
||||
{ address: '5HSDXAC3qEMkSzZK377sTD1zJhjaPiX5tNWppHx2RQMYkjaJ', expectedIconTheme: 'polkadot', name: 'ECDSA Account', type: 'ecdsa' },
|
||||
{ address: '5FjgD3Ns2UpnHJPVeRViMhCttuemaRXEqaD8V5z4vxcsUByA', expectedIconTheme: 'polkadot', name: 'Ed Account', type: 'ed25519' },
|
||||
{ address: '5Ggap6soAPaP5UeNaiJsgqQwdVhhNnm6ez7Ba1w9jJ62LM2Q', expectedIconTheme: 'polkadot', name: 'Parent Sr Account', type: 'sr25519' },
|
||||
{ address: '5HSDXAC3qEMkSzZK377sTD1zJhjaPiX5tNWppHx2RQMYkjaJ', expectedIconTheme: 'pezkuwi', name: 'ECDSA Account', type: 'ecdsa' },
|
||||
{ address: '5FjgD3Ns2UpnHJPVeRViMhCttuemaRXEqaD8V5z4vxcsUByA', expectedIconTheme: 'pezkuwi', name: 'Ed Account', type: 'ed25519' },
|
||||
{ address: '5Ggap6soAPaP5UeNaiJsgqQwdVhhNnm6ez7Ba1w9jJ62LM2Q', expectedIconTheme: 'pezkuwi', name: 'Parent Sr Account', type: 'sr25519' },
|
||||
{ address: '0xd5D81CD4236a43F48A983fc5B895975c511f634D', expectedIconTheme: 'ethereum', name: 'Ethereum', type: 'ethereum' },
|
||||
{ ...externalAccount },
|
||||
{ ...hardwareAccount }
|
||||
] as AccountTestJson[];
|
||||
|
||||
// With Westend genesis Hash
|
||||
// This account isn't part of the generic test because Westend isn't a built in network
|
||||
// With Zagros genesis Hash
|
||||
// This account isn't part of the generic test because Zagros isn't a built in network
|
||||
// The network would only be displayed if the corresponding metadata are known
|
||||
const westEndAccount = {
|
||||
const zagrosAccount = {
|
||||
address: 'Cs2LLqQ6DSRx8UPdVp6jny4DvwNqziBSowSu5Nb1u3R6Z7X',
|
||||
expectedEncodedAddress: '5CMQg2VXTrRWCUewro13qqc45Lf93KtzzS6hWR6dY6pvMZNF',
|
||||
expectedIconTheme: 'polkadot',
|
||||
expectedNetworkLabel: 'Westend',
|
||||
genesisHash: '0xe143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e',
|
||||
expectedIconTheme: 'pezkuwi',
|
||||
expectedNetworkLabel: 'Zagros',
|
||||
genesisHash: '0x0000000000000000000000000000000000000000000000000000000000000003',
|
||||
name: 'acc',
|
||||
type: 'ed25519'
|
||||
} as AccountTestGenesisJson;
|
||||
|
||||
const accountsWithGenesisHash = [
|
||||
// with Polkadot genesis Hash
|
||||
// with Pezkuwi genesis Hash
|
||||
{
|
||||
address: '5Ggap6soAPaP5UeNaiJsgqQwdVhhNnm6ez7Ba1w9jJ62LM2Q',
|
||||
expectedEncodedAddress: '15csxS8s2AqrX1etYMMspzF6V7hM56KEjUqfjJvWHP7YWkoF',
|
||||
expectedIconTheme: 'polkadot',
|
||||
expectedNetworkLabel: 'Polkadot',
|
||||
genesisHash: '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3',
|
||||
expectedIconTheme: 'pezkuwi',
|
||||
expectedNetworkLabel: 'Pezkuwi',
|
||||
genesisHash: '0x0000000000000000000000000000000000000000000000000000000000000001',
|
||||
type: 'sr25519'
|
||||
},
|
||||
// with Kusama genesis Hash
|
||||
// with Dicle genesis Hash
|
||||
{
|
||||
address: '5DoYawpxt6aBy1pKAt1beLMrakqtbWMtG3NF6jwRR8uKJGqD',
|
||||
expectedEncodedAddress: 'EKAFGAqWTb7ifdkwapeYHirjM88QBB4iRCzVQDNtw7p3bgF',
|
||||
expectedIconTheme: 'polkadot',
|
||||
expectedNetworkLabel: 'Kusama',
|
||||
genesisHash: '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe',
|
||||
expectedIconTheme: 'pezkuwi',
|
||||
expectedNetworkLabel: 'Dicle',
|
||||
genesisHash: '0x0000000000000000000000000000000000000000000000000000000000000004',
|
||||
type: 'sr25519'
|
||||
},
|
||||
// with Edgeware genesis Hash
|
||||
{
|
||||
address: '5GYQRJj3NUznYDzCduENRcocMsyxmb6tjb5xW87ZMErBe9R7',
|
||||
expectedEncodedAddress: 'mzKNamvvJPM5ApxwGSYD5VjjtyfrB4g8fhMyCc29K37nuop',
|
||||
expectedIconTheme: 'substrate',
|
||||
expectedIconTheme: 'bizinikiwi',
|
||||
expectedNetworkLabel: 'Edgeware',
|
||||
genesisHash: '0x742a2ca70c2fda6cee4f8df98d64c4c670a052d9568058982dad9d5a7a135c5b',
|
||||
type: 'sr25519'
|
||||
@@ -308,7 +308,7 @@ describe('Address', () => {
|
||||
beforeAll(async () => {
|
||||
jest.spyOn(MetadataCache, 'getSavedMeta').mockImplementation(() => Promise.resolve(westendMetadata));
|
||||
|
||||
wrapper = await getWrapper(westEndAccount, [], false);
|
||||
wrapper = await getWrapper(zagrosAccount, [], false);
|
||||
});
|
||||
|
||||
it('shows westend label with the correct color', () => {
|
||||
@@ -319,7 +319,7 @@ describe('Address', () => {
|
||||
});
|
||||
|
||||
it('shows the account correctly reencoded', () => {
|
||||
expect(wrapper.find('[data-field="address"]').text()).toEqual(westEndAccount.expectedEncodedAddress);
|
||||
expect(wrapper.find('[data-field="address"]').text()).toEqual(zagrosAccount.expectedEncodedAddress);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import type { AccountJson, AccountWithChildren } from '@pezkuwi/extension-base/b
|
||||
import { buildHierarchy } from './buildHierarchy.js';
|
||||
|
||||
const genesisExample = {
|
||||
KUSAMA: '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe',
|
||||
POLKADOT: '0x91b171bb158e2d3848fa23a9f1c25182fb8e20313b2c1eb49219da7a70ce90c3'
|
||||
DICLE: '0x0000000000000000000000000000000000000000000000000000000000000004',
|
||||
PEZKUWI: '0x0000000000000000000000000000000000000000000000000000000000000001'
|
||||
} as const;
|
||||
|
||||
const testHierarchy = (accounts: AccountJson[], expected: AccountWithChildren[]): void => {
|
||||
@@ -69,15 +69,15 @@ describe('Use Account Hierarchy', () => {
|
||||
|
||||
it('sorts accounts by network', () => {
|
||||
testHierarchy(
|
||||
[{ address: 'b', genesisHash: genesisExample.KUSAMA }, { address: 'a', genesisHash: genesisExample.POLKADOT }, { address: 'c', genesisHash: genesisExample.KUSAMA }],
|
||||
[{ address: 'b', genesisHash: genesisExample.KUSAMA }, { address: 'c', genesisHash: genesisExample.KUSAMA }, { address: 'a', genesisHash: genesisExample.POLKADOT }]
|
||||
[{ address: 'b', genesisHash: genesisExample.DICLE }, { address: 'a', genesisHash: genesisExample.PEZKUWI }, { address: 'c', genesisHash: genesisExample.DICLE }],
|
||||
[{ address: 'b', genesisHash: genesisExample.DICLE }, { address: 'c', genesisHash: genesisExample.DICLE }, { address: 'a', genesisHash: genesisExample.PEZKUWI }]
|
||||
);
|
||||
});
|
||||
|
||||
it('sorts accounts by network and name', () => {
|
||||
testHierarchy(
|
||||
[{ address: 'b', genesisHash: genesisExample.KUSAMA, name: 'b-last-kusama' }, { address: 'a', genesisHash: genesisExample.POLKADOT }, { address: 'c', genesisHash: genesisExample.KUSAMA, name: 'a-first-kusama' }],
|
||||
[{ address: 'c', genesisHash: genesisExample.KUSAMA, name: 'a-first-kusama' }, { address: 'b', genesisHash: genesisExample.KUSAMA, name: 'b-last-kusama' }, { address: 'a', genesisHash: genesisExample.POLKADOT }]
|
||||
[{ address: 'b', genesisHash: genesisExample.DICLE, name: 'b-last-kusama' }, { address: 'a', genesisHash: genesisExample.PEZKUWI }, { address: 'c', genesisHash: genesisExample.DICLE, name: 'a-first-kusama' }],
|
||||
[{ address: 'c', genesisHash: genesisExample.DICLE, name: 'a-first-kusama' }, { address: 'b', genesisHash: genesisExample.DICLE, name: 'b-last-kusama' }, { address: 'a', genesisHash: genesisExample.PEZKUWI }]
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user