import * as assert from "assert" ; import { DeploymentDocument } from "../documents/DeploymentDocument" ; import { DeploymentParametersDoc } from "../documents/parameters/DeploymentParametersDoc" ; import { DeploymentTemplateDoc } from "../documents/templates/DeploymentTemplateDoc" ; export function expectTemplateDocumentOrUndefined ( associatedDocument ) { if ( associatedDocument ) { return expectTemplateDocument ( associatedDocument ) ; } return undefined ; } export function expectTemplateDocument ( associatedDocument ) { assert ( ! ! associatedDocument , "Could not find associated template file" ) ; assert ( ! ( associatedDocument instanceof DeploymentParametersDoc ) , `Expected associated document to be a template file, but it appears to be a parameter file` ) ; assert ( associatedDocument instanceof DeploymentTemplateDoc , `Expected associated document to be a template file` ) ; return associatedDocument ; } export function expectParameterDocumentOrUndefined ( associatedDocument ) { if ( associatedDocument ) { return expectParameterDocument ( associatedDocument ) ; } return undefined ; } export function expectParameterDocument ( associatedDocument ) { assert ( ! ! associatedDocument , "Could not find associated parameter file" ) ; assert ( ! ( associatedDocument instanceof DeploymentTemplateDoc ) , `Expected associated document to be a parameter file, but it appears to be a template file` ) ; assert ( associatedDocument instanceof DeploymentParametersDoc , `Expected associated document to be a parameter file` ) ; return associatedDocument ; }