import 'mocha' ; import { expect } from 'chai' ; import { ScriptStub } from '@tests/unit/stubs/ScriptStub' ; import { SelectedScript } from '@/application/Context/State/Selection/SelectedScript' ; describe ( 'SelectedScript' , ( ) => { it ( 'id is same as script id' , ( ) => { const expectedId = 'scriptId' ; const script = new ScriptStub ( expectedId ) ; const sut = new SelectedScript ( script , false ) ; const actualId = sut . id ; expect ( actualId ) . to . equal ( expectedId ) ; } ) ; it ( 'throws when revert is true for irreversible script' , ( ) => { const expectedId = 'scriptId' ; const script = new ScriptStub ( expectedId ) . withRevertCode ( undefined ) ; function construct ( ) { new SelectedScript ( script , true ) ; } expect ( construct ) . to . throw ( 'cannot revert an irreversible script' ) ; } ) ; } ) ;