Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 157 additions & 2 deletions packages/create-cedar-app/tests/templates.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import path from 'node:path'
import klawSync from 'klaw-sync'
import { test, expect } from 'vitest'

const TS_TEMPLATE_DIR = path.join(import.meta.dirname, '../templates/ts')
const JS_TEMPLATE_DIR = path.join(import.meta.dirname, '../templates/js')
const TEMPLATES_DIR = path.join(import.meta.dirname, '../templates')
const TS_TEMPLATE_DIR = path.join(TEMPLATES_DIR, 'ts')
const ESM_TS_TEMPLATE_DIR = path.join(TEMPLATES_DIR, 'esm-ts')
const JS_TEMPLATE_DIR = path.join(TEMPLATES_DIR, 'js')
const ESM_JS_TEMPLATE_DIR = path.join(TEMPLATES_DIR, 'esm-js')

test('files should not have changed unintentionally in TS template', () => {
expect(getDirectoryStructure(TS_TEMPLATE_DIR)).toMatchInlineSnapshot(`
Expand Down Expand Up @@ -158,6 +161,158 @@ test('files should not have changed unintentionally in JS template', () => {
`)
})

test('files should not have changed unintentionally in esm TS template', () => {
expect(getDirectoryStructure(ESM_TS_TEMPLATE_DIR)).toMatchInlineSnapshot(`
[
"/.editorconfig",
"/.env",
"/.env.defaults",
"/.env.example",
"/.vscode",
"/.vscode/extensions.json",
"/.vscode/launch.json",
"/.vscode/settings.json",
"/.vscode/tasks.json",
"/.yarnrc.yml",
"/README.md",
"/api",
"/api/db",
"/api/db/schema.prisma",
"/api/package.json",
"/api/src",
"/api/src/directives",
"/api/src/directives/requireAuth",
"/api/src/directives/requireAuth/requireAuth.test.ts",
"/api/src/directives/requireAuth/requireAuth.ts",
"/api/src/directives/skipAuth",
"/api/src/directives/skipAuth/skipAuth.test.ts",
"/api/src/directives/skipAuth/skipAuth.ts",
"/api/src/functions",
"/api/src/functions/graphql.ts",
"/api/src/graphql",
"/api/src/graphql/.keep",
"/api/src/lib",
"/api/src/lib/auth.ts",
"/api/src/lib/db.ts",
"/api/src/lib/logger.ts",
"/api/src/services",
"/api/src/services/.keep",
"/api/tsconfig.json",
"/api/vitest.config.ts",
"/gitignore.template",
"/graphql.config.cjs",
"/package.json",
"/prettier.config.cjs",
"/redwood.toml",
"/scripts",
"/scripts/.keep",
"/scripts/seed.ts",
"/scripts/tsconfig.json",
"/vitest.config.ts",
"/web",
"/web/package.json",
"/web/public",
"/web/public/README.md",
"/web/public/favicon.png",
"/web/public/robots.txt",
"/web/src",
"/web/src/App.tsx",
"/web/src/Routes.tsx",
"/web/src/components",
"/web/src/components/.keep",
"/web/src/entry.client.tsx",
"/web/src/index.css",
"/web/src/index.html",
"/web/src/layouts",
"/web/src/layouts/.keep",
"/web/src/pages",
"/web/src/pages/FatalErrorPage",
"/web/src/pages/FatalErrorPage/FatalErrorPage.tsx",
"/web/src/pages/NotFoundPage",
"/web/src/pages/NotFoundPage/NotFoundPage.tsx",
"/web/tsconfig.json",
"/web/vite.config.ts",
"/web/vitest.setup.ts",
]
`)
})

test('files should not have changed unintentionally in esm JS template', () => {
expect(getDirectoryStructure(ESM_JS_TEMPLATE_DIR)).toMatchInlineSnapshot(`
[
"/.editorconfig",
"/.env",
"/.env.defaults",
"/.env.example",
"/.vscode",
"/.vscode/extensions.json",
"/.vscode/launch.json",
"/.vscode/settings.json",
"/.vscode/tasks.json",
"/.yarnrc.yml",
"/README.md",
"/api",
"/api/db",
"/api/db/schema.prisma",
"/api/jsconfig.json",
"/api/package.json",
"/api/src",
"/api/src/directives",
"/api/src/directives/requireAuth",
"/api/src/directives/requireAuth/requireAuth.js",
"/api/src/directives/requireAuth/requireAuth.test.js",
"/api/src/directives/skipAuth",
"/api/src/directives/skipAuth/skipAuth.js",
"/api/src/directives/skipAuth/skipAuth.test.js",
"/api/src/functions",
"/api/src/functions/graphql.js",
"/api/src/graphql",
"/api/src/graphql/.keep",
"/api/src/lib",
"/api/src/lib/auth.js",
"/api/src/lib/db.js",
"/api/src/lib/logger.js",
"/api/src/services",
"/api/src/services/.keep",
"/api/vitest.config.js",
"/gitignore.template",
"/graphql.config.cjs",
"/package.json",
"/prettier.config.cjs",
"/redwood.toml",
"/scripts",
"/scripts/.keep",
"/scripts/jsconfig.json",
"/scripts/seed.js",
"/vitest.config.mjs",
"/web",
"/web/jsconfig.json",
"/web/package.json",
"/web/public",
"/web/public/README.md",
"/web/public/favicon.png",
"/web/public/robots.txt",
"/web/src",
"/web/src/App.jsx",
"/web/src/Routes.jsx",
"/web/src/components",
"/web/src/components/.keep",
"/web/src/entry.client.jsx",
"/web/src/index.css",
"/web/src/index.html",
"/web/src/layouts",
"/web/src/layouts/.keep",
"/web/src/pages",
"/web/src/pages/FatalErrorPage",
"/web/src/pages/FatalErrorPage/FatalErrorPage.jsx",
"/web/src/pages/NotFoundPage",
"/web/src/pages/NotFoundPage/NotFoundPage.jsx",
"/web/vite.config.js",
"/web/vitest.setup.js",
]
`)
})

/**
* Used to get the directory structure of the create-cedar-app templates for
* snapshot testing.
Expand Down
Loading