Use import.meta.url instead of process.cwd() (#5675)
* Use import.meta.url instead of process.cwd() * Bump dev
This commit is contained in:
@@ -7,7 +7,7 @@ import type { Registry } from '@polkadot/types-codec/types';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Enum, Null, Text, U32 } from '@polkadot/types-codec';
|
||||
import { u8aToHex } from '@polkadot/util';
|
||||
import { stringify, u8aToHex } from '@polkadot/util';
|
||||
|
||||
import { perf } from '../test/performance.js';
|
||||
|
||||
@@ -358,7 +358,7 @@ describe('Enum', (): void => {
|
||||
it('has a sane output for basic enums', (): void => {
|
||||
expect(
|
||||
new Enum(registry, ['foo', 'bar']).toRawType()
|
||||
).toEqual(JSON.stringify({ _enum: ['foo', 'bar'] }));
|
||||
).toEqual(stringify({ _enum: ['foo', 'bar'] }));
|
||||
});
|
||||
|
||||
it('has a sane output for typed enums', (): void => {
|
||||
@@ -366,7 +366,7 @@ describe('Enum', (): void => {
|
||||
// eslint-disable-next-line sort-keys
|
||||
new Enum(registry, { foo: Text, bar: U32 }).toRawType()
|
||||
// eslint-disable-next-line sort-keys
|
||||
).toEqual(JSON.stringify({ _enum: { foo: 'Text', bar: 'u32' } }));
|
||||
).toEqual(stringify({ _enum: { foo: 'Text', bar: 'u32' } }));
|
||||
});
|
||||
|
||||
it('re-creates via rawType (c-like)', (): void => {
|
||||
@@ -401,7 +401,7 @@ describe('Enum', (): void => {
|
||||
});
|
||||
|
||||
it('creates proper raw structure', (): void => {
|
||||
expect(new Test(registry).toRawType()).toEqual(JSON.stringify({
|
||||
expect(new Test(registry).toRawType()).toEqual(stringify({
|
||||
_enum: {
|
||||
A: 5,
|
||||
B: 42,
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { CodecSet } from '@polkadot/types-codec';
|
||||
import { stringify } from '@polkadot/util';
|
||||
|
||||
// TODO actually import these from definitions, don't re-define here
|
||||
const SET_FIELDS = {
|
||||
@@ -108,7 +109,7 @@ describe('Set', (): void => {
|
||||
it('has a sane toRawType representation', (): void => {
|
||||
expect(
|
||||
new CodecSet(registry, { a: 1, b: 2, c: 345 }).toRawType()
|
||||
).toEqual(JSON.stringify({
|
||||
).toEqual(stringify({
|
||||
_set: { a: 1, b: 2, c: 345 }
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -10,6 +10,7 @@ import type { CodecTo } from '@polkadot/types-codec/types';
|
||||
|
||||
import { TypeRegistry } from '@polkadot/types';
|
||||
import { Enum, Struct, Text, U32, Vec } from '@polkadot/types-codec';
|
||||
import { stringify } from '@polkadot/util';
|
||||
|
||||
import { TEST_A } from './Struct.data.js';
|
||||
|
||||
@@ -314,7 +315,7 @@ describe('Struct', (): void => {
|
||||
counter: U32,
|
||||
vector: Vec.with('AccountId')
|
||||
}).toRawType()
|
||||
).toEqual(JSON.stringify({
|
||||
).toEqual(stringify({
|
||||
accountId: 'AccountId',
|
||||
balanceCompact: 'Compact<Balance>', // Override in Uint
|
||||
blockNumber: 'BlockNumber',
|
||||
@@ -333,7 +334,7 @@ describe('Struct', (): void => {
|
||||
|
||||
expect(
|
||||
new Type(registry).toRawType()
|
||||
).toEqual(JSON.stringify({
|
||||
).toEqual(stringify({
|
||||
accountId: 'AccountId',
|
||||
balance: 'Balance' // Override in Uint
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user