git.delta.rocks / unique-network / refs/commits / 1813dc305c53

difftreelog

source

tests/src/rmrk/setCollectionProperty.test.ts1.6 KiBsourcehistory
1import { getApiConnection } from "../substrate/substrate-api";2import { expectTxFailure } from "./util/helpers";3import { createCollection, setPropertyCollection } from "./util/tx";45describe("integration test: set collection property", () => {6  const Alice = "//Alice";7  const Bob = "//Bob";89  let api: any;10  before(async () => {11    api = await getApiConnection();12  });1314  it("set collection property", async () => {15    await createCollection(16      api,17      Alice,18      "test-metadata",19      null,20      "test-symbol"21    ).then(async (collectionId) => {22      await setPropertyCollection(api, Alice, collectionId, "test_key", "42");23      await setPropertyCollection(api, Alice, collectionId, "test_key", "10");24      await setPropertyCollection(25        api,26        Alice,27        collectionId,28        "second_test_key",29        "111"30      );31    });32  });3334  it("[negative] set non-existing collection property", async () => {35    const tx = setPropertyCollection(36      api,37      Alice,38      9999,39      "test_key",40      "42"41    );42    await expectTxFailure(/rmrkCore\.CollectionUnknown/, tx);43  });4445  it("[negative] set property not an owner NFT collection issuer", async () => {46    await createCollection(47      api,48      Bob,49      "test-metadata",50      null,51      "test-symbol"52    ).then(async (collectionId) => {53        const tx = setPropertyCollection(54          api,55          Alice,56          collectionId,57          "test_key",58          "42"59        );60        await expectTxFailure(/rmrkCore\.NoPermission/, tx);61    });62  });6364  after(() => {65    api.disconnect();66  });67});