parliament.test.js 812 B

12345678910111213141516171819
  1. const { eq, ok } = require('../../helpers/assert');
  2. const { makeNetwork, makePeer } = require('../../helpers/setup');
  3. describe('parliament: propose + vote', (t) => {
  4. t('A proposes candidature for an inhabitant', async () => {
  5. const net = makeNetwork(); const A = makePeer(net); const B = makePeer(net); A.setActor();
  6. const r = await A.use('parliament').proposeCandidature({ candidateId: B.keypair.id, method: 'DEMOCRACY' });
  7. ok(r);
  8. const list = await A.use('parliament').listCandidatures('OPEN');
  9. ok(Array.isArray(list));
  10. });
  11. t('A creates a parliament proposal', async () => {
  12. const net = makeNetwork(); const A = makePeer(net); A.setActor();
  13. const r = await A.use('parliament').createProposal({ title: 'Build park', description: 'in the city center' });
  14. ok(r);
  15. });
  16. });