Skip to content

Commit

Permalink
Update tests.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-c-martin authored Sep 20, 2021
1 parent 9fe0588 commit c4dc457
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tools/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { promisify } from 'util';
import { getLanguageService } from 'vscode-json-languageservice';
import { TextDocument } from 'vscode-languageserver-types';
import draft4MetaSchema from 'ajv/lib/refs/json-schema-draft-04.json';
import draft7MetaSchema from 'ajv/lib/refs/json-schema-draft-07.json';
import * as schemaTestsRunner from './schemaTestsRunner';
import 'mocha';
import { findCycle } from './cycleCheck';
Expand All @@ -20,15 +19,13 @@ const testSchemasFolder = __dirname + '/schemas/';
const templateTestsFolder = __dirname + '/templateTests/';
const armSchemasPrefix = /^https?:\/\/schema\.management\.azure\.com\/schemas\//
const jsonSchemaDraft4Prefix = /^https?:\/\/json-schema\.org\/draft-04\/schema/
const jsonSchemaDraft7Prefix = /^https?:\/\/json-schema\.org\/draft-07\/schema/

const ajvInstance = new Ajv({
loadSchema: loadSchema,
strictDefaults: true,
schemaId: 'id',
meta: false
meta: true,
}).addMetaSchema(draft4MetaSchema)
.addMetaSchema(draft7MetaSchema)
.addFormat('int32', /.*/)
.addFormat('duration', /.*/)
.addFormat('password', /.*/);
Expand All @@ -46,9 +43,6 @@ async function loadRawSchema(uri: string) : Promise<string> {
else if (uri.match(jsonSchemaDraft4Prefix)) {
return JSON.stringify(draft4MetaSchema);
}
else if (uri.match(jsonSchemaDraft7Prefix)) {
return JSON.stringify(draft7MetaSchema);
}
else {
jsonPath = uri;
}
Expand Down Expand Up @@ -91,7 +85,6 @@ function listSchemaPaths(basePath: string): string[] {

const metaSchemaPaths = [
'http://json-schema.org/draft-04/schema',
'http://json-schema.org/draft-07/schema',
testSchemasFolder + 'ResourceMetaSchema.json',
];

Expand Down Expand Up @@ -140,6 +133,7 @@ const schemasToSkip = [
'2019-08-01/managementGroupDeploymentTemplate.json',
'2019-08-01/tenantDeploymentParameters.json',
'2019-08-01/tenantDeploymentTemplate.json',
'2021-09-09/uiFormDefinition.schema.json',
'common/definitions.json',
'common/manuallyAddedResources.json',
'common/autogeneratedResources.json',
Expand Down Expand Up @@ -235,4 +229,4 @@ describe('Validate test templates against VSCode language service', () => {
expect(result).to.deep.equal([]);
});
}
});
});

0 comments on commit c4dc457

Please sign in to comment.