Skip to content

Commit

Permalink
random type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zxbodya committed Nov 1, 2023
1 parent 5a6e862 commit 0ec9d99
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/utils/test/testUtils/testData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ export const TEST_ERROR_LIST_OUTPUT: RJSFValidationError[] = reduce(
[]
);

export const SUPER_SCHEMA: RJSFSchema = deepFreeze({
export const SUPER_SCHEMA: RJSFSchema = deepFreeze<RJSFSchema>({
[ID_KEY]: 'super-schema',
definitions: {
test: {
Expand Down Expand Up @@ -506,7 +506,7 @@ export const SUPER_SCHEMA: RJSFSchema = deepFreeze({
},
},
],
});
} satisfies RJSFSchema);

export const PROPERTY_DEPENDENCIES: RJSFSchema = deepFreeze({
type: 'object',
Expand Down
1 change: 1 addition & 0 deletions packages/utils/test/toErrorList.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe('toErrorList()', () => {
expect(toErrorList({})).toEqual([]);
});
it('Returns an empty array when an object with a non-plain child object is provided', () => {
// @ts-expect-error testing unexpected argument handling
expect(toErrorList({ nonObject: new Error('non-object') })).toEqual([]);
});
it('Returns the expected list of errors when given an ErrorSchema', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ describe('compileSchemaValidatorsCode()', () => {
describe('compiling without additional options', () => {
let schemas: RJSFSchema[];
beforeAll(() => {
schemas = Object.values(schemaParser(superSchema as RJSFSchema));
schemas = Object.values(schemaParser(superSchema as unknown as RJSFSchema));
expectedCode = readFileSync('./test/harness/superSchema.js').toString();
generatedCode = compileSchemaValidatorsCode(superSchema as RJSFSchema);
generatedCode = compileSchemaValidatorsCode(superSchema as unknown as RJSFSchema);
});
it('create AJV instance was called with the expected options', () => {
const expectedCompileOpts = { code: { source: true, lines: true }, schemas };
Expand All @@ -33,9 +33,9 @@ describe('compileSchemaValidatorsCode()', () => {
let schemas: RJSFSchema[];
let expectedCode: string;
beforeAll(() => {
schemas = Object.values(schemaParser(superSchema as RJSFSchema));
schemas = Object.values(schemaParser(superSchema as unknown as RJSFSchema));
expectedCode = readFileSync('./test/harness/superSchemaOptions.js').toString();
generatedCode = compileSchemaValidatorsCode(superSchema as RJSFSchema, {
generatedCode = compileSchemaValidatorsCode(superSchema as unknown as RJSFSchema, {
...CUSTOM_OPTIONS,
ajvOptionsOverrides: { ...CUSTOM_OPTIONS.ajvOptionsOverrides, code: { lines: false } },
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type TestType = {
};

const validateFns = superSchemaFns as ValidatorFunctions;
const rootSchema = superSchema as RJSFSchema;
const rootSchema = superSchema as unknown as RJSFSchema;
const mockedValidator = jest.mocked(AJV8PrecompiledValidator);

describe('createPrecompiledValidator()', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/validator-ajv8/test/precompiledValidator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import superSchema from './harness/superSchema.json';

const validateFns = superSchemaFns as ValidatorFunctions;
const validateOptionsFns = superSchemaOptionsFns as ValidatorFunctions;
const rootSchema = superSchema as RJSFSchema;
const rootSchema = superSchema as unknown as RJSFSchema;

describe('AJV8PrecompiledValidator', () => {
let builder: ErrorSchemaBuilder;
Expand Down

0 comments on commit 0ec9d99

Please sign in to comment.