* test: initial * test: update * test: lint * test: faucet asset checks * test: lint * test: tweaks * test: tweaks * test: lint * test: tweaks * test: lint * test: re-arrange into views * test: lint
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
declare global {
|
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
namespace Cypress {
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
interface Chainable<Subject> {
|
|
get_asset_information(): void;
|
|
}
|
|
}
|
|
}
|
|
|
|
export function addGetAssetInformation() {
|
|
// @ts-ignore - ignoring Cypress type error which gets resolved when Cypress uses the command
|
|
Cypress.Commands.add('get_asset_information', () => {
|
|
const mutation =
|
|
'{ assets {name id decimals globalRewardPoolAccount {balance}}}';
|
|
cy.request({
|
|
method: 'POST',
|
|
url: `http://localhost:3028/query`,
|
|
body: {
|
|
query: mutation,
|
|
},
|
|
headers: { 'content-type': 'application/json' },
|
|
})
|
|
.its(`body.data.assets`)
|
|
.then(function (response) {
|
|
// @ts-ignore - ignoring Cypress type error which gets resolved when Cypress uses the command
|
|
const object = response.reduce(function (assets, entry) {
|
|
assets[entry.name] = {
|
|
rewardPoolBalance: entry.globalRewardPoolAccount.balance,
|
|
id: entry.id,
|
|
decimals: entry.decimals,
|
|
};
|
|
return assets;
|
|
}, {});
|
|
|
|
return object;
|
|
});
|
|
});
|
|
}
|