git.delta.rocks / unique-network / refs/commits / 4b68421a192f

difftreelog

tests: destroyCollection respects OwnerCanDestroy

Yaroslav Bolyukin2021-02-19parent: #acba88f.patch.diff
in: master

1 file changed

modifiedtests/src/destroyCollection.test.tsdiffbeforeafterboth
3// file 'LICENSE', which is part of this source code package.3// file 'LICENSE', which is part of this source code package.
4//4//
55
6import { IKeyringPair } from '@polkadot/types/types';
6import chai from 'chai';7import chai from 'chai';
7import chaiAsPromised from 'chai-as-promised';8import chaiAsPromised from 'chai-as-promised';
9import privateKey from './substrate/privateKey';
8import { default as usingApi } from "./substrate/substrate-api";10import { default as usingApi } from "./substrate/substrate-api";
9import { createCollectionExpectSuccess, destroyCollectionExpectSuccess, destroyCollectionExpectFailure } from "./util/helpers";11import { createCollectionExpectSuccess, destroyCollectionExpectSuccess, destroyCollectionExpectFailure, setCollectionLimitsExpectSuccess } from "./util/helpers";
1012
11chai.use(chaiAsPromised);13chai.use(chaiAsPromised);
1214
26});28});
2729
28describe('(!negative test!) integration test: ext. destroyCollection():', () => {30describe('(!negative test!) integration test: ext. destroyCollection():', () => {
31 let alice: IKeyringPair;
32
33 before(async () => {
34 await usingApi(async (api) => {
35 alice = privateKey('//Alice');
36 });
37 });
38
29 it('(!negative test!) Destroy a collection that never existed', async () => {39 it('(!negative test!) Destroy a collection that never existed', async () => {
30 await usingApi(async (api) => {40 await usingApi(async (api) => {
43 await destroyCollectionExpectFailure(collectionId, '//Bob');53 await destroyCollectionExpectFailure(collectionId, '//Bob');
44 await destroyCollectionExpectSuccess(collectionId, '//Alice');54 await destroyCollectionExpectSuccess(collectionId, '//Alice');
45 });55 });
56 it('fails when OwnerCanDestroy == false', async () => {
57 const collectionId = await createCollectionExpectSuccess();
58 await setCollectionLimitsExpectSuccess(alice, collectionId, { OwnerCanDestroy: false });
59
60 await destroyCollectionExpectFailure(collectionId, '//Alice');
61 });
46});62});
4763