difftreelog
Merge pull request #51 from usetech-llc/feature/NFTPAR-246_remove_sponsor_tests
in: master
NFTPAR-246 remove sponsor tests
3 files changed
tests/src/confirmSponsorship.test.tsdiffbeforeafterboth--- a/tests/src/confirmSponsorship.test.ts
+++ b/tests/src/confirmSponsorship.test.ts
@@ -32,7 +32,7 @@
let bob: IKeyringPair;
let charlie: IKeyringPair;
-describe.only('integration test: ext. confirmSponsorship():', () => {
+describe('integration test: ext. confirmSponsorship():', () => {
before(async () => {
await usingApi(async (api) => {
@@ -299,7 +299,7 @@
});
-describe.only('(!negative test!) integration test: ext. setCollectionSponsor():', () => {
+describe('(!negative test!) integration test: ext. removeCollectionSponsor():', () => {
before(async () => {
await usingApi(async (api) => {
const keyring = new Keyring({ type: 'sr25519' });
tests/src/removeCollectionSponsor.test.tsdiffbeforeafterbothno changes
tests/src/util/helpers.tsdiffbeforeafterboth--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -213,6 +213,39 @@
});
}
+export async function removeCollectionSponsorExpectSuccess(collectionId: number) {
+ await usingApi(async (api) => {
+
+ // Run the transaction
+ const alicePrivateKey = privateKey('//Alice');
+ const tx = api.tx.nft.removeCollectionSponsor(collectionId);
+ const events = await submitTransactionAsync(alicePrivateKey, tx);
+ const result = getGenericResult(events);
+
+ // Get the collection
+ const collection: any = (await api.query.nft.collection(collectionId)).toJSON();
+
+ // What to expect
+ expect(result.success).to.be.true;
+ expect(collection.Sponsor).to.be.equal(nullPublicKey);
+ expect(collection.SponsorConfirmed).to.be.false;
+ });
+}
+
+export async function removeCollectionSponsorExpectFailure(collectionId: number) {
+ await usingApi(async (api) => {
+
+ // Run the transaction
+ const alicePrivateKey = privateKey('//Alice');
+ const tx = api.tx.nft.removeCollectionSponsor(collectionId);
+ const events = await submitTransactionAsync(alicePrivateKey, tx);
+ const result = getGenericResult(events);
+
+ // What to expect
+ expect(result.success).to.be.false;
+ });
+}
+
export async function setCollectionSponsorExpectFailure(collectionId: number, sponsor: string, senderSeed: string = '//Alice') {
await usingApi(async (api) => {