Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
paula-stacho committed Feb 13, 2025
1 parent b0706f2 commit aa931c6
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 75 deletions.
24 changes: 12 additions & 12 deletions src/schema-accessor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Schema as InternalSchema } from './schema-analyzer';

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 18.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 18.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 18.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 16.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 16.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 16.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 16.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 16.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 16.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 18.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 18.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 18.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 18.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 20.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 16.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 16.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 16.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 20.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 16.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 16.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (macos-latest, 16.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 18.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 18.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 18.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 16.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 16.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 16.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 20.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 18.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 18.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 18.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 16.x)

Cannot find module './schema-converters/internalToExpanded' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 16.x)

Cannot find module './schema-converters/internalToMongoDB' or its corresponding type declarations.

Check failure on line 1 in src/schema-accessor.ts

View workflow job for this annotation

GitHub Actions / Test (windows-latest, 16.x)

Cannot find module './schema-converters/internalToStandard' or its corresponding type declarations.
import InternalToExpandedConvertor from './schema-convertors/internalToExpanded';
import InternalToMongoDBConvertor from './schema-convertors/internalToMongoDB';
import InternalToStandardConvertor from './schema-convertors/internalToStandard';
import InternalToExpandedConverter from './schema-converters/internalToExpanded';
import InternalToMongoDBConverter from './schema-converters/internalToMongoDB';
import InternalToStandardConverter from './schema-converters/internalToStandard';
import { ExpandedJSONSchema, MongoDBJSONSchema, StandardJSONSchema } from './types';

export interface SchemaAccessor {
Expand All @@ -26,15 +26,15 @@ export class InternalSchemaBasedAccessor implements SchemaAccessor {
private standardJSONSchema?: StandardJSONSchema;
private mongodbJSONSchema?: MongoDBJSONSchema;
private ExpandedJSONSchema?: ExpandedJSONSchema;
public internalToStandardConvertor: InternalToStandardConvertor;
public internalToExpandedConvertor: InternalToExpandedConvertor;
public internalToMongoDBConvertor: InternalToMongoDBConvertor;
public internalToStandardConverter: InternalToStandardConverter;
public internalToExpandedConverter: InternalToExpandedConverter;
public internalToMongoDBConverter: InternalToMongoDBConverter;

constructor(internalSchema: InternalSchema) {
this.internalSchema = internalSchema;
this.internalToStandardConvertor = new InternalToStandardConvertor();
this.internalToExpandedConvertor = new InternalToExpandedConvertor();
this.internalToMongoDBConvertor = new InternalToMongoDBConvertor();
this.internalToStandardConverter = new InternalToStandardConverter();
this.internalToExpandedConverter = new InternalToExpandedConverter();
this.internalToMongoDBConverter = new InternalToMongoDBConverter();
}

async getInternalSchema(): Promise<InternalSchema> {
Expand All @@ -46,20 +46,20 @@ export class InternalSchemaBasedAccessor implements SchemaAccessor {
* https://json-schema.org/draft/2020-12/schema
*/
async getStandardJsonSchema(options: Options = {}): Promise<StandardJSONSchema> {
return this.standardJSONSchema ??= await this.internalToStandardConvertor.convert(this.internalSchema, options);
return this.standardJSONSchema ??= await this.internalToStandardConverter.convert(this.internalSchema, options);
}

/**
* Get MongoDB's $jsonSchema
*/
async getMongoDBJsonSchema(options: Options = {}): Promise<MongoDBJSONSchema> {
return this.mongodbJSONSchema ??= await this.internalToMongoDBConvertor.convert(this.internalSchema, options);
return this.mongodbJSONSchema ??= await this.internalToMongoDBConverter.convert(this.internalSchema, options);
}

/**
* Get expanded JSON Schema - with additional properties
*/
async getExpandedJSONSchema(options: Options = {}): Promise<ExpandedJSONSchema> {
return this.ExpandedJSONSchema ??= await this.internalToExpandedConvertor.convert(this.internalSchema, options);
return this.ExpandedJSONSchema ??= await this.internalToExpandedConverter.convert(this.internalSchema, options);
}
}
38 changes: 19 additions & 19 deletions src/schema-convertors/internalToExpanded.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'assert';
import { RELAXED_EJSON_DEFINITIONS } from './internalToStandard';
import InternalToExpandedConvertor from './internalToExpanded';
import InternalToExpandedConverter from './internalToExpanded';

describe('internalSchemaToExpanded', async function() {
describe('Converts: ', async function() {
Expand Down Expand Up @@ -336,8 +336,8 @@ describe('internalSchemaToExpanded', async function() {
}
]
};
const convertor = new InternalToExpandedConvertor();
const expanded = await convertor.convert(internal);
const converter = new InternalToExpandedConverter();
const expanded = await converter.convert(internal);
const expectedDefinitions: any = RELAXED_EJSON_DEFINITIONS;
delete expectedDefinitions.BSONSymbol;
delete expectedDefinitions.CodeWScope;
Expand Down Expand Up @@ -602,8 +602,8 @@ describe('internalSchemaToExpanded', async function() {
}
]
};
const convertor = new InternalToExpandedConvertor();
const expanded = await convertor.convert(internal);
const converter = new InternalToExpandedConverter();
const expanded = await converter.convert(internal);
const expectedDefinitions = {
Double: RELAXED_EJSON_DEFINITIONS.Double
};
Expand Down Expand Up @@ -717,8 +717,8 @@ describe('internalSchemaToExpanded', async function() {
}
]
};
const convertor = new InternalToExpandedConvertor();
const expanded = await convertor.convert(internal);
const converter = new InternalToExpandedConverter();
const expanded = await converter.convert(internal);
assert.deepStrictEqual(expanded, {
type: 'object',
'x-bsonType': 'object',
Expand Down Expand Up @@ -881,8 +881,8 @@ describe('internalSchemaToExpanded', async function() {
}
]
};
const convertor = new InternalToExpandedConvertor();
const expanded = await convertor.convert(internal);
const converter = new InternalToExpandedConverter();
const expanded = await converter.convert(internal);
assert.deepStrictEqual(expanded, {
type: 'object',
'x-bsonType': 'object',
Expand Down Expand Up @@ -1017,8 +1017,8 @@ describe('internalSchemaToExpanded', async function() {
}
]
};
const convertor = new InternalToExpandedConvertor();
const expanded = await convertor.convert(internal);
const converter = new InternalToExpandedConverter();
const expanded = await converter.convert(internal);
assert.deepStrictEqual(expanded, {
type: 'object',
'x-bsonType': 'object',
Expand Down Expand Up @@ -1127,8 +1127,8 @@ describe('internalSchemaToExpanded', async function() {
}
]
};
const convertor = new InternalToExpandedConvertor();
const expanded = await convertor.convert(internal);
const converter = new InternalToExpandedConverter();
const expanded = await converter.convert(internal);
assert.deepStrictEqual(expanded, {
type: 'object',
'x-bsonType': 'object',
Expand Down Expand Up @@ -1269,8 +1269,8 @@ describe('internalSchemaToExpanded', async function() {
}
]
};
const convertor = new InternalToExpandedConvertor();
const expanded = await convertor.convert(internal);
const converter = new InternalToExpandedConverter();
const expanded = await converter.convert(internal);
assert.deepStrictEqual(expanded, {
type: 'object',
'x-bsonType': 'object',
Expand Down Expand Up @@ -1378,8 +1378,8 @@ describe('internalSchemaToExpanded', async function() {
}
]
};
const convertor = new InternalToExpandedConvertor();
const expanded = await convertor.convert(internal);
const converter = new InternalToExpandedConverter();
const expanded = await converter.convert(internal);
const expectedDefinitions = {
ObjectId: RELAXED_EJSON_DEFINITIONS.ObjectId
};
Expand Down Expand Up @@ -1529,8 +1529,8 @@ describe('internalSchemaToExpanded', async function() {
]
};
const abortController = new AbortController();
const convertor = new InternalToExpandedConvertor();
const promise = convertor.convert(internal, { signal: abortController.signal });
const converter = new InternalToExpandedConverter();
const promise = converter.convert(internal, { signal: abortController.signal });
abortController.abort(new Error('Too long, didn\'t wait.'));
await assert.rejects(promise, {
name: 'Error',
Expand Down
4 changes: 2 additions & 2 deletions src/schema-convertors/internalToExpanded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { InternalTypeToStandardTypeMap, RELAXED_EJSON_DEFINITIONS } from './inte
import { InternalTypeToBsonTypeMap } from './internalToMongoDB';
import { allowAbort } from './util';

class InternalToExpandedConvertor {
class InternalToExpandedConverter {
private usedDefinitions = new Set<string>();

private clearUsedDefintions() {
Expand Down Expand Up @@ -120,4 +120,4 @@ class InternalToExpandedConvertor {
}
}

export default InternalToExpandedConvertor;
export default InternalToExpandedConverter;
34 changes: 17 additions & 17 deletions src/schema-convertors/internalToMongoDB.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'assert';
import InternalToMongoDBConvertor from './internalToMongoDB';
import InternalToMongoDBConverter from './internalToMongoDB';

describe('internalSchemaToMongoDB', async function() {
describe('Converts: ', async function() {
Expand Down Expand Up @@ -892,8 +892,8 @@ describe('internalSchemaToMongoDB', async function() {
}
]
};
const convertor = new InternalToMongoDBConvertor();
const mongodb = await convertor.convert(internal);
const converter = new InternalToMongoDBConverter();
const mongodb = await converter.convert(internal);
assert.deepStrictEqual(mongodb, {
bsonType: 'object',
required: [],
Expand Down Expand Up @@ -1106,8 +1106,8 @@ describe('internalSchemaToMongoDB', async function() {
}
]
};
const convertor = new InternalToMongoDBConvertor();
const mongodb = await convertor.convert(internal);
const converter = new InternalToMongoDBConverter();
const mongodb = await converter.convert(internal);
assert.deepStrictEqual(mongodb, {
bsonType: 'object',
required: ['author'],
Expand Down Expand Up @@ -1192,8 +1192,8 @@ describe('internalSchemaToMongoDB', async function() {
}
]
};
const convertor = new InternalToMongoDBConvertor();
const mongodb = await convertor.convert(internal);
const converter = new InternalToMongoDBConverter();
const mongodb = await converter.convert(internal);
assert.deepStrictEqual(mongodb, {
bsonType: 'object',
required: [],
Expand Down Expand Up @@ -1338,8 +1338,8 @@ describe('internalSchemaToMongoDB', async function() {
}
]
};
const convertor = new InternalToMongoDBConvertor();
const mongodb = await convertor.convert(internal);
const converter = new InternalToMongoDBConverter();
const mongodb = await converter.convert(internal);
assert.deepStrictEqual(mongodb, {
bsonType: 'object',
required: [],
Expand Down Expand Up @@ -1433,8 +1433,8 @@ describe('internalSchemaToMongoDB', async function() {
}
]
};
const convertor = new InternalToMongoDBConvertor();
const mongodb = await convertor.convert(internal);
const converter = new InternalToMongoDBConverter();
const mongodb = await converter.convert(internal);
assert.deepStrictEqual(mongodb, {
bsonType: 'object',
required: ['arrayMixedType'],
Expand Down Expand Up @@ -1512,8 +1512,8 @@ describe('internalSchemaToMongoDB', async function() {
}
]
};
const convertor = new InternalToMongoDBConvertor();
const mongodb = await convertor.convert(internal);
const converter = new InternalToMongoDBConverter();
const mongodb = await converter.convert(internal);
assert.deepStrictEqual(mongodb, {
bsonType: 'object',
required: [],
Expand Down Expand Up @@ -1629,8 +1629,8 @@ describe('internalSchemaToMongoDB', async function() {
}
]
};
const convertor = new InternalToMongoDBConvertor();
const mongodb = await convertor.convert(internal);
const converter = new InternalToMongoDBConverter();
const mongodb = await converter.convert(internal);
assert.deepStrictEqual(mongodb, {
bsonType: 'object',
required: [],
Expand Down Expand Up @@ -1764,8 +1764,8 @@ describe('internalSchemaToMongoDB', async function() {
]
};
const abortController = new AbortController();
const convertor = new InternalToMongoDBConvertor();
const promise = convertor.convert(internal, { signal: abortController.signal });
const converter = new InternalToMongoDBConverter();
const promise = converter.convert(internal, { signal: abortController.signal });
abortController.abort(new Error('Too long, didn\'t wait.'));
await assert.rejects(promise, {
name: 'Error',
Expand Down
4 changes: 2 additions & 2 deletions src/schema-convertors/internalToMongoDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const InternalTypeToBsonTypeMap: Record<
MaxKey: 'maxKey'
};

class InternalToMongoDBConvertor {
class InternalToMongoDBConverter {
private convertInternalType(type: string) {
const bsonType = InternalTypeToBsonTypeMap[type];
if (!bsonType) throw new Error(`Encountered unknown type: ${type}`);
Expand Down Expand Up @@ -112,4 +112,4 @@ class InternalToMongoDBConvertor {
}
}

export default InternalToMongoDBConvertor;
export default InternalToMongoDBConverter;
38 changes: 19 additions & 19 deletions src/schema-convertors/internalToStandard.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import assert from 'assert';
import Ajv2020 from 'ajv/dist/2020';
import InternalToStandardConvertor, { RELAXED_EJSON_DEFINITIONS } from './internalToStandard';
import InternalToStandardConverter, { RELAXED_EJSON_DEFINITIONS } from './internalToStandard';

describe('internalSchemaToStandard', async function() {
const ajv = new Ajv2020();
Expand Down Expand Up @@ -895,8 +895,8 @@ describe('internalSchemaToStandard', async function() {
}
]
};
const convertor = new InternalToStandardConvertor();
const standard = await convertor.convert(internal);
const converter = new InternalToStandardConverter();
const standard = await converter.convert(internal);
ajv.validateSchema(standard);
const expectedDefinitions: any = {
...RELAXED_EJSON_DEFINITIONS
Expand Down Expand Up @@ -1117,8 +1117,8 @@ describe('internalSchemaToStandard', async function() {
}
]
};
const convertor = new InternalToStandardConvertor();
const standard = await convertor.convert(internal);
const converter = new InternalToStandardConverter();
const standard = await converter.convert(internal);
const expectedDefinitions = {
Double: RELAXED_EJSON_DEFINITIONS.Double
};
Expand Down Expand Up @@ -1209,8 +1209,8 @@ describe('internalSchemaToStandard', async function() {
}
]
};
const convertor = new InternalToStandardConvertor();
const standard = await convertor.convert(internal);
const converter = new InternalToStandardConverter();
const standard = await converter.convert(internal);
ajv.validateSchema(standard);
assert.deepStrictEqual(standard, {
$schema: 'https://json-schema.org/draft/2020-12/schema',
Expand Down Expand Up @@ -1358,8 +1358,8 @@ describe('internalSchemaToStandard', async function() {
}
]
};
const convertor = new InternalToStandardConvertor();
const standard = await convertor.convert(internal);
const converter = new InternalToStandardConverter();
const standard = await converter.convert(internal);
ajv.validateSchema(standard);
assert.deepStrictEqual(standard, {
$schema: 'https://json-schema.org/draft/2020-12/schema',
Expand Down Expand Up @@ -1456,8 +1456,8 @@ describe('internalSchemaToStandard', async function() {
}
]
};
const convertor = new InternalToStandardConvertor();
const standard = await convertor.convert(internal);
const converter = new InternalToStandardConverter();
const standard = await converter.convert(internal);
ajv.validateSchema(standard);
assert.deepStrictEqual(standard, {
$schema: 'https://json-schema.org/draft/2020-12/schema',
Expand Down Expand Up @@ -1538,8 +1538,8 @@ describe('internalSchemaToStandard', async function() {
}
]
};
const convertor = new InternalToStandardConvertor();
const standard = await convertor.convert(internal);
const converter = new InternalToStandardConverter();
const standard = await converter.convert(internal);
ajv.validateSchema(standard);
assert.deepStrictEqual(standard, {
$schema: 'https://json-schema.org/draft/2020-12/schema',
Expand Down Expand Up @@ -1658,8 +1658,8 @@ describe('internalSchemaToStandard', async function() {
}
]
};
const convertor = new InternalToStandardConvertor();
const standard = await convertor.convert(internal);
const converter = new InternalToStandardConverter();
const standard = await converter.convert(internal);
ajv.validateSchema(standard);
assert.deepStrictEqual(standard, {
$schema: 'https://json-schema.org/draft/2020-12/schema',
Expand Down Expand Up @@ -1739,8 +1739,8 @@ describe('internalSchemaToStandard', async function() {
}
]
};
const convertor = new InternalToStandardConvertor();
const standard = await convertor.convert(internal);
const converter = new InternalToStandardConverter();
const standard = await converter.convert(internal);
ajv.validateSchema(standard);
const expectedDefinitions = {
ObjectId: RELAXED_EJSON_DEFINITIONS.ObjectId
Expand Down Expand Up @@ -1868,8 +1868,8 @@ describe('internalSchemaToStandard', async function() {
]
};
const abortController = new AbortController();
const convertor = new InternalToStandardConvertor();
const promise = convertor.convert(internal, { signal: abortController.signal });
const converter = new InternalToStandardConverter();
const promise = converter.convert(internal, { signal: abortController.signal });
abortController.abort(new Error('Too long, didn\'t wait.'));
await assert.rejects(promise, {
name: 'Error',
Expand Down
Loading

0 comments on commit aa931c6

Please sign in to comment.