'use strict' ; import * as chai from 'chai' ; import * as sinonChai from 'sinon-chai' ; import * as chaiAsPromised from 'chai-as-promised' ; import { PackageRegistryEntry } from '../../extension/registries/PackageRegistryEntry' ; import { PackageRegistry } from '../../extension/registries/PackageRegistry' ; chai . use ( sinonChai ) ; chai . use ( chaiAsPromised ) ; const should = chai . should ( ) ; module . exports = function ( ) : any { /**
     * Given
     */ this . Given ( /the contract has been packaged as a (cds|tar\.gz|tgz)/ , this . timeout , async ( _packageFormat ) => { this . packageFormat = _packageFormat ; this . packageRegistryEntry = await this . smartContractHelper . packageSmartContract ( this . contractDefinitionName , this . contractDefinitionVersion , this . contractLanguage , this . contractDirectory , this . packageFormat ) ; } ) ; this . Given ( /the package has been deleted/ , this . timeout , async ( ) => { if ( this . packageRegistryEntry ) { await PackageRegistry . instance ( ) . delete ( this . packageRegistryEntry ) ; } } ) ; /**
     * When
     */ this . When ( /I package the contract as a (cds|tar\.gz|tgz)/ , this . timeout , async ( _packageFormat ) => { this . packageFormat = _packageFormat ; this . packageRegistryEntry = await this . smartContractHelper . packageSmartContract ( this . contractDefinitionName , this . contractDefinitionVersion , this . contractLanguage , this . contractDirectory , this . packageFormat ) ; } ) ; this . When ( /I run the command View package Information for package with name (.*) and version (.\S+)/ , this . timeout , async ( packagedName , version ) => { await this . smartContractHelper . viewContractInformation ( packagedName , version ) ; } ) ; /**
     * Then
     */ this . Then ( 'a new package should be created with the name {string} and version {string}' , this . timeout , async ( packageName , packageVersion ) => { const _package = await PackageRegistry . instance ( ) . get ( packageName , packageVersion ) ; _package . should . exist ; } ) ; this . Then ( 'no package should be created with the name {string} and version {string}' , this . timeout , async ( packageName , packageVersion ) => { const _package = await PackageRegistry . instance ( ) . get ( packageName , packageVersion ) ; should . equal ( undefined , _package ) ; } ) ; } ;