git.delta.rocks / unique-network / refs/commits / e62b55890acd

difftreelog

source

tests/src/rmrk/createBase.seqtest.ts2.1 KiBsourcehistory
1import {getApiConnection} from '../substrate/substrate-api';2import {requirePallets, Pallets} from './util/helpers';3import {createCollection, createBase} from './util/tx';45describe('integration test: create new Base', () => {6  let api: any;7  before(async function() {8    api = await getApiConnection();9    await requirePallets(this, [Pallets.RmrkCore, Pallets.RmrkEquip]);10  });1112  const alice = '//Alice';1314  it('create empty Base', async () => {15    await createBase(api, alice, 'empty-base-type', 'EBase', []);16  });1718  it('create Base with fixed part', async () => {19    await createBase(api, alice, 'fixedpart-base-type', 'FPBase', [20      {21        'FixedPart': {22          id: 42,23          z: 0,24          src: 'some-fixed-url',25        },26      },27    ]);28  });2930  it('create Base with slot part (no collection)', async () => {31    await createBase(api, alice, 'slotpart-base-type', 'SPBase', [32      {33        'SlotPart': {34          id: 112,35          equippable: 'Empty',36          z: 0,37          src: 'some-fallback-slot-url',38        },39      },40    ]);41  });4243  it('create Base with slot part (any collection)', async () => {44    await createBase(api, alice, 'slotpartany-base-type', 'SPABase', [45      {46        'SlotPart': {47          id: 222,48          equippable: 'All',49          z: 1,50          src: 'some-fallback-slot-url',51        },52      },53    ]);54  });5556  it('create Base with slot part (custom collections)', async () => {57    const firstCollectionId = await createCollection(58      api,59      alice,60      'first-collection-meta',61      null,62      'first-collection',63    );6465    const secondCollectionId = await createCollection(66      api,67      alice,68      'first-collection-meta',69      null,70      'first-collection',71    );7273    await createBase(api, alice, 'slotpartcustom-base-type', 'SPCBase', [74      {75        'SlotPart': {76          id: 1024,77          equippable: {78            'Custom': [firstCollectionId, secondCollectionId],79          },80          z: 2,81          src: 'some-fallback-slot-url',82        },83      },84    ]);85  });8687  after(async() => { await api.disconnect(); });88});