diff --git a/package.json b/package.json index 2bd125c..ae1ccdd 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,9 @@ "build": "rm -rf ./dist && tsc -p tsconfig.build.json", "build:watch": "tsc -p tsconfig.build.json -w", "build:type-check": "tsc -p tsconfig.build.json --noEmit", - "test": "node --trace-warnings --experimental-vm-modules 'node_modules/jest/bin/jest.js' .", - "test:watch": "node --trace-warnings --experimental-vm-modules 'node_modules/jest/bin/jest.js' . --watch", - "test:coverage": "node --trace-warnings --experimental-vm-modules 'node_modules/jest/bin/jest.js' . --no-cache --coverage", + "test": "node --trace-warnings --experimental-vm-modules 'node_modules/jest/bin/jest.js'", + "test:watch": "node --trace-warnings --experimental-vm-modules 'node_modules/jest/bin/jest.js' --watch", + "test:coverage": "node --trace-warnings --experimental-vm-modules 'node_modules/jest/bin/jest.js' --no-cache --coverage", "format": "prettier --write \"**/*.{ts,js,md,json,yaml,yml}\"", "lint": "eslint .", "lint:fix": "eslint . --fix", @@ -64,21 +64,19 @@ "dependencies": { "@aws-sdk/client-s3": "3.511.0", "@aws-sdk/lib-storage": "3.511.0", - "fast-glob": "^3.3.2", "globby": "^14.0.1", "mrmime": "2.0.0", "winston": "^3.11.0", "zod": "3.22.4" }, "lint-staged": { - "*.ts": [ + "(/test/.*\\.test\\.ts)$": [ "npm run test" ], "*.{ts,js}": [ - "npm run lint", - "npm run format" + "npm run lint" ], - "*.{json,md,yaml}": [ + "*.{ts,js,json,md,yaml}": [ "npm run format" ] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e418717..197f2b9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,9 +11,6 @@ dependencies: '@aws-sdk/lib-storage': specifier: 3.511.0 version: 3.511.0(@aws-sdk/client-s3@3.511.0) - fast-glob: - specifier: ^3.3.2 - version: 3.3.2 globby: specifier: ^14.0.1 version: 14.0.1 diff --git a/src/schemas/input.ts b/src/schemas/input.ts index d329945..c92a8a8 100644 --- a/src/schemas/input.ts +++ b/src/schemas/input.ts @@ -1,12 +1,7 @@ import { ObjectCannedACL } from '@aws-sdk/client-s3' import type { ObjectCannedACL as ObjectCannedACLType } from '@aws-sdk/client-s3' -// import fg from 'fast-glob' import { z } from 'zod' -// function isGlobbyPattern(pattern: string): boolean { -// return fg.isDynamicPattern(pattern) -// } - type ObjectCannedACLsTuple = [ObjectCannedACLType, ...ObjectCannedACLType[]] // Cast to ObjectCannedACLsTuple @@ -18,14 +13,8 @@ const tags = z.record(z.string(), z.string()) const storage = z.object({ name: z.string(), + // Ref: https://github.com/mrmlnc/fast-glob#pattern-syntax patterns: z.array(z.string()).min(1), - // .refine((patterns) => patterns.every(isGlobbyPattern), { - // // https://github.com/mrmlnc/fast-glob#pattern-syntax - // // `patterns` is an array of glob patterns. Each pattern must be a valid - // // glob pattern. A glob pattern is a string of literal and special - // // characters used to match file paths. - // message: 'Patterns must be compatible with glob pattern syntax.', - // }), actions: z.array(z.string()).default(['upload', 'delete']), prefix: z.string().default(''), enabled: z.boolean().default(true), diff --git a/test/schemas/input.fixture.ts b/test/schemas/input.fixture.ts index 6a8ede0..012289a 100644 --- a/test/schemas/input.fixture.ts +++ b/test/schemas/input.fixture.ts @@ -156,11 +156,6 @@ export const createValidInputFileFixture = (): Required => { return baseInputFixture } -export const createValidInputDirectoryFixture = (): Required => { - const baseInputFixture = createBaseInputFixture() - return baseInputFixture -} - export const createInvalidInputFixture = ( additionalProps: DeepPartial = {} ) => ({ diff --git a/test/schemas/input.test.ts b/test/schemas/input.test.ts index 007290f..5f14e62 100644 --- a/test/schemas/input.test.ts +++ b/test/schemas/input.test.ts @@ -1,26 +1,20 @@ import { createInvalidInputFixture, - createValidInputDirectoryFixture, createValidInputFileFixture, } from './input.fixture' import { custom } from '../../src/schemas/input' describe('Input Custom Schema', () => { it('should validate the generated fake data', () => { - const fileInput = createValidInputFileFixture() - const result1 = custom.safeParse(fileInput) + const input = createValidInputFileFixture() + const result = custom.safeParse(input) - expect(result1.success).toBe(true) - - const directoryInput = createValidInputDirectoryFixture() - const result2 = custom.safeParse(directoryInput) - - expect(result2.success).toBe(true) + expect(result.success).toBe(true) }) it('should throw an error if the data is invalid', () => { - const fakeData = createInvalidInputFixture() - const result = custom.safeParse(fakeData) + const invalidInput = createInvalidInputFixture() + const result = custom.safeParse(invalidInput) expect(result.success).toBe(false) })