|
@@ -8,8 +8,14 @@ import { setTestTimeout } from '../../utils/setTestTimeout';
|
|
|
import tap from 'tap';
|
|
|
import { registerJoystreamTypes } from '@nicaea/types';
|
|
|
import { closeApi } from '../impl/closeApi';
|
|
|
-import { ApiWrapper } from '../../utils/apiWrapper';
|
|
|
-import { createWorkingGroupLeaderOpening, voteForProposal } from './impl/proposalsModule';
|
|
|
+import { ApiWrapper, WorkingGroups } from '../../utils/apiWrapper';
|
|
|
+import {
|
|
|
+ createWorkingGroupLeaderOpening,
|
|
|
+ voteForProposal,
|
|
|
+ beginWorkingGroupLeaderApplicationReview,
|
|
|
+ expectLeadOpeningAdded,
|
|
|
+} from './impl/proposalsModule';
|
|
|
+import { applyForOpening } from '../workingGroup/impl/workingGroupModule';
|
|
|
|
|
|
tap.mocha.describe('Set lead proposal scenario', async () => {
|
|
|
initConfig();
|
|
@@ -17,6 +23,7 @@ tap.mocha.describe('Set lead proposal scenario', async () => {
|
|
|
|
|
|
const m1KeyPairs: KeyringPair[] = new Array();
|
|
|
const m2KeyPairs: KeyringPair[] = new Array();
|
|
|
+ const leadKeyPair: KeyringPair[] = new Array();
|
|
|
|
|
|
const keyring = new Keyring({ type: 'sr25519' });
|
|
|
const N: number = +process.env.MEMBERSHIP_CREATION_N!;
|
|
@@ -28,7 +35,7 @@ tap.mocha.describe('Set lead proposal scenario', async () => {
|
|
|
const lesserStake: BN = new BN(+process.env.COUNCIL_STAKE_LESSER_AMOUNT!);
|
|
|
const applicationStake: BN = new BN(process.env.WORKING_GROUP_APPLICATION_STAKE!);
|
|
|
const roleStake: BN = new BN(process.env.WORKING_GROUP_ROLE_STAKE!);
|
|
|
- const durationInBlocks: number = 29;
|
|
|
+ const durationInBlocks: number = 40;
|
|
|
|
|
|
const provider = new WsProvider(nodeUrl);
|
|
|
const apiWrapper: ApiWrapper = await ApiWrapper.create(provider);
|
|
@@ -37,15 +44,44 @@ tap.mocha.describe('Set lead proposal scenario', async () => {
|
|
|
setTestTimeout(apiWrapper, durationInBlocks);
|
|
|
membershipTest(apiWrapper, m1KeyPairs, keyring, N, paidTerms, sudoUri);
|
|
|
membershipTest(apiWrapper, m2KeyPairs, keyring, N, paidTerms, sudoUri);
|
|
|
+ membershipTest(apiWrapper, leadKeyPair, keyring, 1, paidTerms, sudoUri);
|
|
|
councilTest(apiWrapper, m1KeyPairs, m2KeyPairs, keyring, K, sudoUri, greaterStake, lesserStake);
|
|
|
|
|
|
let proposalId: BN;
|
|
|
+ let openingId: BN;
|
|
|
tap.test(
|
|
|
'Create leader opening',
|
|
|
async () =>
|
|
|
- (proposalId = await createWorkingGroupLeaderOpening(apiWrapper, m1KeyPairs, sudo, applicationStake, roleStake))
|
|
|
+ (proposalId = await createWorkingGroupLeaderOpening(
|
|
|
+ apiWrapper,
|
|
|
+ m1KeyPairs,
|
|
|
+ sudo,
|
|
|
+ applicationStake,
|
|
|
+ roleStake,
|
|
|
+ 'Storage'
|
|
|
+ ))
|
|
|
+ );
|
|
|
+ tap.test('Approve proposal', async () => {
|
|
|
+ voteForProposal(apiWrapper, m2KeyPairs, sudo, proposalId);
|
|
|
+ openingId = await expectLeadOpeningAdded(apiWrapper);
|
|
|
+ });
|
|
|
+ tap.test(
|
|
|
+ 'Apply for lead opening',
|
|
|
+ async () =>
|
|
|
+ await applyForOpening(
|
|
|
+ apiWrapper,
|
|
|
+ leadKeyPair,
|
|
|
+ sudo,
|
|
|
+ applicationStake,
|
|
|
+ roleStake,
|
|
|
+ new BN(openingId),
|
|
|
+ WorkingGroups.storageWorkingGroup,
|
|
|
+ false
|
|
|
+ )
|
|
|
+ );
|
|
|
+ tap.test('Begin leader application review', async () =>
|
|
|
+ beginWorkingGroupLeaderApplicationReview(apiWrapper, m1KeyPairs, sudo, new BN(openingId), 'Storage')
|
|
|
);
|
|
|
- tap.test('Approve proposal', async () => voteForProposal(apiWrapper, m2KeyPairs, sudo, proposalId));
|
|
|
|
|
|
closeApi(apiWrapper);
|
|
|
});
|