difftreelog
tests: add setCollectionLimits helpers
in: master
Signed-off-by: Yaroslav Bolyukin <iam@lach.pw> (cherry picked from commit 94a4122205b94c771af170233121c5cdc6d3e60c)
1 file changed
tests/src/util/helpers.tsdiffbeforeafterboth295 });295 });296}296}297298export async function queryCollectionLimits(collectionId: number) {299 return await usingApi(async (api) => {300 return ((await api.query.nft.collection(collectionId)).toJSON() as any).Limits;301 });302}303304export async function setCollectionLimitsExpectSuccess(sender: IKeyringPair, collectionId: number, limits: any) {305 await usingApi(async (api) => {306 const oldLimits = await queryCollectionLimits(collectionId);307 const newLimits = { ...oldLimits as any, ...limits };308 const tx = api.tx.nft.setCollectionLimits(collectionId, newLimits);309 const events = await submitTransactionAsync(sender, tx);310 const result = getGenericResult(events);311312 expect(result.success).to.be.true;313 });314}315316export async function setCollectionLimitsExpectFailure(sender: IKeyringPair, collectionId: number, limits: any) {317 await usingApi(async (api) => {318 const oldLimits = await queryCollectionLimits(collectionId);319 const newLimits = { ...oldLimits as any, ...limits };320 const tx = api.tx.nft.setCollectionLimits(collectionId, newLimits);321 const events = await expect(submitTransactionExpectFailAsync(sender, tx)).to.be.rejected;322 const result = getGenericResult(events);323324 expect(result.success).to.be.false;325 });326}297327298export async function setCollectionSponsorExpectSuccess(collectionId: number, sponsor: string) {328export async function setCollectionSponsorExpectSuccess(collectionId: number, sponsor: string) {299 await usingApi(async (api) => {329 await usingApi(async (api) => {