concept current workflow status in category ethereum

appears as: The current workflow status, Current Workflow Status, current workflow status
Building Ethereum Dapps: Decentralized applications on the Ethereum blockchain

This is an excerpt from Manning's book Building Ethereum Dapps: Decentralized applications on the Ethereum blockchain.

Listing 12.2. testSimpleVoting.js: testing ending the proposal registration session
const SimpleVoting = artifacts.require("./SimpleVoting.sol");

contract('SimpleVoting', function(accounts) {     
  contract('SimpleVoting.endProposalRegistration - 
    onlyAdministrator modifier ', 
    function(accounts) {
     it("The voting administrator should be able to end the proposal 
 registration session only after it has started", 
       async function() {                                              #1
       //arrange 
       let simpleVotingInstance = await SimpleVoting.deployed();
       let votingAdministrator = await simpleVotingInstance.administrator();
                    
       let nonVotingAdministrator = web3.eth.accounts[1];     
                                           
       try {
            //act
            await simpleVotingInstance.endProposalsRegistration(

              {from: nonVotingAdministrator});
            assert.isTrue(false);                                      #2
       }
       catch(e) {
            //assert
            assert.isTrue(votingAdministrator != nonVotingAdministrator);
            assert.equal(e, "Error: VM Exception while processing 
 transaction: revert - the caller of this function 
 must be the administrator");                                        #3
       }
     });
  });
     
  contract('SimpleVoting.endProposalRegistration - 
    onlyDuringProposalsRegistration modifier', 
    function(accounts) {
     it("An account that is not the voting administrator must not be able 
 to end the proposal registration session", 
       async function() {                                              #4
       //arrange 
       let simpleVotingInstance = await SimpleVoting.deployed();
       let votingAdministrator = await simpleVotingInstance.administrator();

       try {
         //act
            await simpleVotingInstance.endProposalsRegistration(
              {from: votingAdministrator});
            assert.isTrue(false);                                      #5
       }
       catch(e) {
            //assert
            assert.equal(e, "Error: VM Exception while processing 
 transaction: revert - this function can be called only 
 during proposals registration");                                    #6
       }
     });                                   
  });

  contract('SimpleVoting.endProposalRegistration - successful', 
    function(accounts) {
     it("An account that is not the voting administrator must 
 not be able to end the proposal registration session", 
       async function() {                                              #7
       //arrange 
       let simpleVotingInstance = await SimpleVoting.deployed();
       let votingAdministrator = await simpleVotingInstance.administrator();

       await simpleVotingInstance.startProposalsRegistration(
          {from: votingAdministrator});
       let workflowStatus = await simpleVotingInstance.getWorkflowStatus();
       let expectedWorkflowStatus = 1;

       assert.equal(workflowStatus.valueOf(), expectedWorkflowStatus, 
          "The current workflow status does not correspond 
 to proposal registration session started"); 

       //act
       await simpleVotingInstance.endProposalsRegistration(
         {from: votingAdministrator});
       let newWorkflowStatus = await simpleVotingInstance
         .getWorkflowStatus();
       let newExpectedWorkflowStatus = 2;
                    
       //assert
       assert.equal(newWorkflowStatus.valueOf(), newExpectedWorkflowStatus,
         "The current workflow status does not correspond 
            to proposal registration session ended");                #8

       });
     });
});