git.delta.rocks / unique-network / refs/commits / b1da5059f1c6

difftreelog

fix warn about skipped tests

Daniel Shiposha2022-08-09parent: #3d7ffe7.patch.diff
in: master

1 file changed

modifiedtests/src/util/helpers.tsdiffbeforeafterboth
47 ReFungible = 'refungible',47 ReFungible = 'refungible',
48 Fungible = 'fungible',48 Fungible = 'fungible',
49 NFT = 'nonfungible',49 NFT = 'nonfungible',
50 Scheduler = 'scheduler',
50}51}
5152
52export async function isUnique(): Promise<boolean> {53export async function isUnique(): Promise<boolean> {
72 return modulesNames;73 return modulesNames;
73}74}
7475
75export function requirePallets(mocha: Context, api: ApiPromise, requiredPallets: string[]) {76export async function missingRequiredPallets(requiredPallets: string[]): Promise<string[]> {
77 return await usingApi(async api => {
76 const pallets = getModuleNames(api);78 const pallets = getModuleNames(api);
7779
78 const isAllPalletsPresent = requiredPallets.every(p => pallets.includes(p));80 return requiredPallets.filter(p => !pallets.includes(p));
79
80 if (!isAllPalletsPresent) {
81 mocha.skip();81 });
82 }
83}82}
83
84export async function checkPalletsPresence(requiredPallets: string[]): Promise<boolean> {
85 return (await missingRequiredPallets(requiredPallets)).length == 0;
86}
87
88export async function requirePallets(mocha: Context, requiredPallets: string[]) {
89 const missingPallets = await missingRequiredPallets(requiredPallets);
90
91 if (missingPallets.length > 0) {
92 const skippingTestMsg = `\tSkipping test "${mocha.test?.title}".`;
93 const missingPalletsMsg = `\tThe following pallets are missing:\n\t- ${missingPallets.join('\n\t- ')}`;
94 const skipMsg = `${skippingTestMsg}\n${missingPalletsMsg}`;
95
96 console.log('\x1b[38:5:208m%s\x1b[0m', skipMsg);
97
98 mocha.skip();
99 }
100}
84101
85export function normalizeAccountId(input: string | AccountId | CrossAccountId | IKeyringPair): CrossAccountId {102export function normalizeAccountId(input: string | AccountId | CrossAccountId | IKeyringPair): CrossAccountId {
86 if (typeof input === 'string') {103 if (typeof input === 'string') {