import * as path from 'path' ; import { testDiagnosticsFromFile } from "./support/diagnostics" ; import { testWithLanguageServer } from './support/testWithLanguageServer' ; import { testMessages } from './testConstants' ; suite ( "arm-template-language-samples" , ( ) => { function testSample ( templateName , expectedErrors = [ ] ) { testWithLanguageServer ( templateName , async ( ) => { await testDiagnosticsFromFile ( path . join ( 'templates' , 'arm-template-language-samples' , templateName ) , { } , expectedErrors ) ; } ) ; } suite ( "passing" , ( ) => { testSample ( "any-property-at-any-level-can-be-an-expression.json" ) ; testSample ( "apiProfile.json" ) ; testSample ( "apiprofile2.json" ) ; testSample ( "apiprofile3.json" ) ; testSample ( "arm-is-not-case-sensitive.json" ) ; testSample ( "copy-and-multiline-values.json" ) ; testSample ( "schema-expressions-everywhere.json" ) ; testSample ( "some-schema-thing-I-have-not-seen-before.json" , [ `Warning: Please use https for the schema URL (arm-template (schema))` ] ) ; testSample ( "udf-xmas-tree.json" , [ `Error: Template validation failed: The template function 'storageUri' at line '15' and column '21' is not valid. These function calls are not supported in a function definition: 'reference'. Please see https://aka.ms/arm-template/#functions for usage details. (arm-template (validation))` ] ) ; testSample ( "valid-invalid-json.json" , [ `Error: Expected a function or property expression. (arm-template (expressions))` , `Error: Expected a right square bracket (']'). (arm-template (expressions))` ] ) ; testSample ( "variable-copy-sample.json" ) ; testSample ( "variable-use-via-copy.json" ) ; testSample ( "variable-use.json" ) ; testSample ( "nested-deployment-scoping.json" ) ; testSample ( "azuredeploy.inline.json" , [ `${ testMessages . nestedTemplateNoValidation ( "fetchSecret" ) } (arm-template (expressions)) [19,21-19,34]` ] ) ; } ) ; suite ( "failing" , ( ) => { test ( "apiVersion-can-be-an-expression.json" ) ; test ( "apiVersion-can-be-an-expression2.json" ) ; test ( "object-variable-properties.json" ) ; test ( "variables-object-use-determination.json" ) ; } ) ; } ) ;