Skip to content

Commit

Permalink
refacor: move tests next together
Browse files Browse the repository at this point in the history
  • Loading branch information
amir78729 committed Jul 21, 2024
1 parent f44d269 commit bed8a11
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 52 deletions.
50 changes: 0 additions & 50 deletions src/builder/JsonSchemaBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,56 +58,6 @@ export class JsonSchemaBuilder {
}
}

// private deleteNestedPropertyByPath = (obj: JsonSchema, path: string): JsonSchema => {
// const keys = path.split('.');
// const newObject = { ...obj };
//
// if (keys.length === 0) {
// return newObject;
// }
//
// let current = newObject;
// const stack = [];
//
// for (let i = 0; i < keys.length - 1; i++) {
// stack.push(current); //@ts-expect-error // eslint-disable-line @typescript-eslint/ban-ts-comment
// current[keys[i]] = { ...current[keys[i]] }; //@ts-expect-error // eslint-disable-line @typescript-eslint/ban-ts-comment
// current = current[keys[i]];
// }
// //@ts-expect-error // eslint-disable-line @typescript-eslint/ban-ts-comment
// delete current[keys[keys.length - 1]];
//
// for (let i = keys.length - 2; i >= 0; i--) {
// const key = keys[i]; //@ts-expect-error // eslint-disable-line @typescript-eslint/ban-ts-comment
//
// current = stack.pop(); //@ts-expect-error // eslint-disable-line @typescript-eslint/ban-ts-comment
// if (Object.keys(current[key]).length === 0) {//@ts-expect-error // eslint-disable-line @typescript-eslint/ban-ts-comment
// delete current[key];
// }
// }
//
// return newObject;
// };
//
// private updateNestedObjectByPath = (obj: JsonSchema, path: string, value: unknown): JsonSchema => {
// console.log('🐕 sag path', path); // TODO: REMOVE ME ⚠️
//
// const keys = path.split('.');
// const newObject = { ...obj };
//
// let current = newObject;
// keys.forEach((key, index) => {
// if (index === keys.length - 1) { //@ts-expect-error // eslint-disable-line @typescript-eslint/ban-ts-comment
// current[key] = value;
// } else { //@ts-expect-error // eslint-disable-line @typescript-eslint/ban-ts-comment
// current[key] = current[key] ? { ...current[key] } : {}; //@ts-expect-error // eslint-disable-line @typescript-eslint/ban-ts-comment
// current = current[key];
// }
// });
//
// return newObject;
// };

private deleteNestedPropertyByPath = (obj: JsonSchema, path: string): JsonSchema => {
const keys = path.split('.');
const newObject = { ...obj };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JsonSchemaBuilder } from './JsonSchemaBuilder';
import { JsonSchemaBuilder } from '../builder/JsonSchemaBuilder';
import { SCHEMA_TYPE } from '../constants';
import { Format, JsonSchema } from '../types';

Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.test.ts → src/test/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { accessToObjectFieldByPath, accessToObjectFieldParentByPath } from './index'; // Adjust the import to match your file structure
import { accessToObjectFieldByPath, accessToObjectFieldParentByPath } from '../utils'; // Adjust the import to match your file structure

describe('accessToObjectFieldByPath', () => {
const testObject = {
Expand Down

0 comments on commit bed8a11

Please sign in to comment.