Files
pezkuwi-apps/packages/page-alliance/src/util.spec.ts
T
pezkuwichain 7a4bbeac25 fix: update extension packages and fix type compatibility for pezkuwi-sdk
- Update @pezkuwi/extension-inject to ^0.62.13 with proper /types exports
- Update @pezkuwi/extension-dapp to ^0.62.13
- Update @pezkuwi/extension-compat-metamask to ^0.62.13
- Fix IconTheme type to include 'bizinikiwi' and 'pezkuwi' themes
- Fix endpoint array issues (getTeleports -> direct array references)
- Add type assertions for external package compatibility (acala, moonbeam, parallel)
- Fix subspace.ts dynamic class typing
- Fix conviction type in page-referenda
- Update Pallet type names to Pezpallet prefix across codebase
- Define InjectedExtension types locally for module resolution
- Add styled-components DefaultTheme augmentation
- Add react-copy-to-clipboard type declaration for React 18

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 16:24:19 +03:00

49 lines
1.4 KiB
TypeScript

// Copyright 2017-2026 @pezkuwi/app-alliance authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@pezkuwi/dev-test/globals.d.ts" />
import { Metadata, TypeRegistry } from '@pezkuwi/types';
import bizinikiwi from '@pezkuwi/types-support/metadata/static-bizinikiwi';
import { createCid, createPalletCid } from './util.js';
const registry = new TypeRegistry();
const metadata = new Metadata(registry, bizinikiwi);
registry.setMetadata(metadata);
describe('util', (): void => {
describe('createPalletCid', (): void => {
it('encodes an ipfs hash to a pallet CID', (): void => {
expect(
createPalletCid(registry, 'QmTx8GZrQGwQ1ZLquZ4yPqSukDdkvKwpYCULsfLo6G47TX')?.toHuman()
).toEqual({
codec: 0x70.toString(),
hash_: {
code: 0x12.toString(),
digest: '0x5360ecbd380c10f43bc0a6aba27556580011a5e833592df8dcf330c94759e862'
},
version: 'V0'
});
});
});
describe('createIpfsHash', (): void => {
it('encodes a pallet CID into an ipfs hash', (): void => {
const cid = registry.createType('PezpalletAllianceCid', {
codec: 0x70,
hash_: {
code: 0x12,
digest: '0x5360ecbd380c10f43bc0a6aba27556580011a5e833592df8dcf330c94759e862'
},
version: 'V0'
});
expect(
createCid(cid).ipfs
).toEqual('QmTx8GZrQGwQ1ZLquZ4yPqSukDdkvKwpYCULsfLo6G47TX');
});
});
});