From a853a9f78e6c22f04e7c2346a17bb4e1aa33144e Mon Sep 17 00:00:00 2001 From: esteban-url <14810250+esteban-url@users.noreply.github.com> Date: Mon, 30 Dec 2024 09:41:31 -0600 Subject: [PATCH] test(scaffold): update tests to expect 48 files instead of 19 --- .../generate/scaffold/__tests__/scaffold.test.js | 8 ++++---- .../scaffold/__tests__/scaffoldNoNest.test.js | 8 ++++---- .../generate/scaffold/__tests__/scaffoldPath.test.js | 8 ++++---- .../scaffold/__tests__/scaffoldPathMulti.test.js | 8 ++++---- .../__tests__/scaffoldPathMultiNoNest.test.js | 8 ++++---- .../scaffold/__tests__/scaffoldPathMultiword.test.js | 12 ++++++------ .../__tests__/scaffoldPathMultiwordNoNest.test.js | 12 ++++++------ .../scaffold/__tests__/scaffoldPathNoNest.test.js | 8 ++++---- .../cli/src/commands/generate/scaffold/scaffold.js | 4 ++-- 9 files changed, 38 insertions(+), 38 deletions(-) diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/scaffold.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/scaffold.test.js index 233ed5beb4fe..40b081d51305 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/scaffold.test.js +++ b/packages/cli/src/commands/generate/scaffold/__tests__/scaffold.test.js @@ -45,8 +45,8 @@ describe('in javascript (default) mode', () => { }) }) - test('returns exactly 19 files', async () => { - expect(Object.keys(files).length).toEqual(19) + test('returns exactly 48 files', async () => { + expect(Object.keys(files).length).toEqual(48) }) // SDL @@ -466,8 +466,8 @@ describe('in typescript mode', () => { }) }) - test('returns exactly 19 files', () => { - expect(Object.keys(tsFiles).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(tsFiles).length).toEqual(48) }) // SDL diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldNoNest.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldNoNest.test.js index abbfb05f6fba..26ee08d92431 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldNoNest.test.js +++ b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldNoNest.test.js @@ -27,8 +27,8 @@ describe('in javascript (default) mode', () => { }) }) - test('returns exactly 19 files', () => { - expect(Object.keys(files).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(files).length).toEqual(48) }) // SDL @@ -308,8 +308,8 @@ describe('in typescript mode', () => { }) }) - test('returns exactly 19 files', () => { - expect(Object.keys(tsFiles).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(tsFiles).length).toEqual(48) }) // SDL diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPath.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPath.test.js index be52063bcaaf..f0630ceda792 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPath.test.js +++ b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPath.test.js @@ -28,8 +28,8 @@ describe('admin/post', () => { }) describe('creates the correct files with the correct imports', () => { - it('returns exactly 19 files', () => { - expect(Object.keys(filesLower).length).toEqual(19) + it('returns exactly 48 files', () => { + expect(Object.keys(filesLower).length).toEqual(48) }) // Layout @@ -359,8 +359,8 @@ describe('Admin/Post', () => { }) describe('creates the correct files with the correct imports', () => { - it('returns exactly 19 files', () => { - expect(Object.keys(filesUpper).length).toEqual(19) + it('returns exactly 48 files', () => { + expect(Object.keys(filesUpper).length).toEqual(48) }) // Layout diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMulti.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMulti.test.js index 2f65d0a0a645..07d1aa7aaae9 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMulti.test.js +++ b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMulti.test.js @@ -28,8 +28,8 @@ describe('admin/pages/post', () => { }) describe('creates the correct files with the correct imports', () => { - test('returns exactly 19 files', () => { - expect(Object.keys(filesNestedLower).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(filesNestedLower).length).toEqual(48) }) // Layout @@ -369,8 +369,8 @@ describe('Admin/Pages/Post/Post', () => { }) describe('creates the correct files with the correct imports', () => { - test('returns exactly 19 files', () => { - expect(Object.keys(filesNestedUpper).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(filesNestedUpper).length).toEqual(48) }) // Layout diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMultiNoNest.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMultiNoNest.test.js index 538995b4aaa2..a3656d143fa4 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMultiNoNest.test.js +++ b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMultiNoNest.test.js @@ -28,8 +28,8 @@ describe('admin/pages/post', () => { }) describe('creates the correct files with the correct imports', () => { - test('returns exactly 19 files', () => { - expect(Object.keys(filesNestedLower).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(filesNestedLower).length).toEqual(48) }) // Layout @@ -361,8 +361,8 @@ describe('Admin/Pages/Post/Post', () => { }) describe('creates the correct files with the correct imports', () => { - test('returns exactly 19 files', () => { - expect(Object.keys(filesNestedUpper).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(filesNestedUpper).length).toEqual(48) }) // Layout diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMultiword.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMultiword.test.js index 0d79faa24e19..ce0e9d03e179 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMultiword.test.js +++ b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMultiword.test.js @@ -28,8 +28,8 @@ describe('AdminPages/Post', () => { }) describe('creates the correct files with the correct imports', () => { - test('returns exactly 19 files', () => { - expect(Object.keys(filesMultiwordUpper).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(filesMultiwordUpper).length).toEqual(48) }) // Layout @@ -369,8 +369,8 @@ describe('admin-pages/Post', () => { }) describe('creates the correct files with the correct imports', () => { - test('returns exactly 19 files', () => { - expect(Object.keys(filesMultiwordDash).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(filesMultiwordDash).length).toEqual(48) }) // Layout @@ -710,8 +710,8 @@ describe('admin_pages/Post', () => { }) describe('creates the correct files with the correct imports', () => { - test('returns exactly 19 files', () => { - expect(Object.keys(filesMultiwordUnderscore).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(filesMultiwordUnderscore).length).toEqual(48) }) // Layout diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMultiwordNoNest.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMultiwordNoNest.test.js index fe0d4c7b7c82..bef5c9031889 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMultiwordNoNest.test.js +++ b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathMultiwordNoNest.test.js @@ -28,8 +28,8 @@ describe('AdminPages/Post', () => { }) describe('creates the correct files with the correct imports', () => { - test('returns exactly 19 files', () => { - expect(Object.keys(filesMultiwordUpper).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(filesMultiwordUpper).length).toEqual(48) }) // Layout @@ -361,8 +361,8 @@ describe('admin-pages/Post', () => { }) describe('creates the correct files with the correct imports', () => { - test('returns exactly 19 files', () => { - expect(Object.keys(filesMultiwordDash).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(filesMultiwordDash).length).toEqual(48) }) // Layout @@ -694,8 +694,8 @@ describe('admin_pages/Post', () => { }) describe('creates the correct files with the correct imports', () => { - test('returns exactly 19 files', () => { - expect(Object.keys(filesMultiwordUnderscore).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(filesMultiwordUnderscore).length).toEqual(48) }) // Layout diff --git a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathNoNest.test.js b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathNoNest.test.js index c246c191b291..9267a37978d8 100644 --- a/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathNoNest.test.js +++ b/packages/cli/src/commands/generate/scaffold/__tests__/scaffoldPathNoNest.test.js @@ -28,8 +28,8 @@ describe('admin/Post', () => { }) describe('creates the correct files with the correct imports', () => { - test('returns exactly 19 files', () => { - expect(Object.keys(filesLower).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(filesLower).length).toEqual(48) }) // Layout @@ -357,8 +357,8 @@ describe('Admin/Post', () => { }) describe('creates the correct files with the correct imports', () => { - test('returns exactly 19 files', () => { - expect(Object.keys(filesUpper).length).toEqual(19) + test('returns exactly 48 files', () => { + expect(Object.keys(filesUpper).length).toEqual(48) }) // Layout diff --git a/packages/cli/src/commands/generate/scaffold/scaffold.js b/packages/cli/src/commands/generate/scaffold/scaffold.js index a2d631480e06..64a448ab9d9b 100644 --- a/packages/cli/src/commands/generate/scaffold/scaffold.js +++ b/packages/cli/src/commands/generate/scaffold/scaffold.js @@ -528,7 +528,7 @@ const pageFiles = async ( const finalFolder = (nestScaffoldByModel ? singularName + '/' : '') + outputPageName - .replace(/(?:\.test|\.mock|\.stories)(?=\.ts)/, '') + .replace(/(?:\.test|\.mock|\.stories)(?=\.ts|\.js)/, '') .replace(/\.[jt]sx?/, '') const outputPath = path.join( @@ -625,7 +625,7 @@ const componentFiles = async ( const finalFolder = (nestScaffoldByModel ? singularName + '/' : '') + outputComponentName - .replace(/(?:\.test|\.mock|\.stories)(?=\.ts)/, '') + .replace(/(?:\.test|\.mock|\.stories)(?=\.ts|\.js)/, '') .replace(/\.[jt]sx?/, '') const outputPath = path.join(