From 07feb6e31391deec5893a68b14de98ed9721b0be Mon Sep 17 00:00:00 2001 From: KaviiSuri Date: Wed, 16 Oct 2024 23:38:15 +0530 Subject: [PATCH] fix: setup tailwind and ui package for console --- apps/console-electron/app/dashboard/page.tsx | 4 +- apps/console-electron/app/page.tsx | 5 +- apps/console-electron/package.json | 8 +- apps/console-electron/tailwind.config.ts | 10 +- apps/playground-web/tailwind.config.ts | 5 - package.json | 2 + pnpm-lock.yaml | 49 +++++----- src/lib/__tests__/api.test.ts | 93 ------------------- .../tailwind-config/base.tailwind.config.ts | 1 + 9 files changed, 46 insertions(+), 131 deletions(-) delete mode 100644 src/lib/__tests__/api.test.ts diff --git a/apps/console-electron/app/dashboard/page.tsx b/apps/console-electron/app/dashboard/page.tsx index b42146e..e0073eb 100644 --- a/apps/console-electron/app/dashboard/page.tsx +++ b/apps/console-electron/app/dashboard/page.tsx @@ -2,9 +2,7 @@ import Link from 'next/link'; export default function Another() { return ( -
+
Go back

Dashboard Page

diff --git a/apps/console-electron/app/page.tsx b/apps/console-electron/app/page.tsx index c521e53..17b593d 100644 --- a/apps/console-electron/app/page.tsx +++ b/apps/console-electron/app/page.tsx @@ -1,3 +1,4 @@ +import { Button } from '@dicedb/ui/button'; import Link from 'next/link'; export default function Home() { @@ -13,7 +14,9 @@ export default function Home() { src="https://avatars.githubusercontent.com/u/112580013?s=48&v=4" alt="logo" /> - Home +
); diff --git a/apps/console-electron/package.json b/apps/console-electron/package.json index 2b08b4d..e675192 100644 --- a/apps/console-electron/package.json +++ b/apps/console-electron/package.json @@ -14,7 +14,8 @@ "dependencies": { "next": "14.2.15", "react": "^18", - "react-dom": "^18" + "react-dom": "^18", + "@dicedb/ui": "workspace:*" }, "devDependencies": { "@dicedb/eslint-config": "workspace:*", @@ -28,6 +29,9 @@ "eslint-config-next": "14.2.15", "postcss": "^8", "tailwindcss": "^3.4.1", - "typescript": "^5" + "typescript": "^5", + "@dicedb/typescript-config": "workspace:*", + "@dicedb/eslint-config": "workspace:*", + "@dicedb/tailwind-config": "workspace:*" } } diff --git a/apps/console-electron/tailwind.config.ts b/apps/console-electron/tailwind.config.ts index ce9d9a7..4814875 100644 --- a/apps/console-electron/tailwind.config.ts +++ b/apps/console-electron/tailwind.config.ts @@ -1,13 +1,13 @@ import type { Config } from 'tailwindcss'; +import baseConfig from '@dicedb/tailwind-config/base'; const config: Config = { - content: [ - './pages/**/*.{js,ts,jsx,tsx,mdx}', - './components/**/*.{js,ts,jsx,tsx,mdx}', - './app/**/*.{js,ts,jsx,tsx,mdx}', - ], + ...baseConfig, theme: { extend: { + fontFamily: { + Assistant: ['Assistant'], + }, colors: { background: 'var(--background)', foreground: 'var(--foreground)', diff --git a/apps/playground-web/tailwind.config.ts b/apps/playground-web/tailwind.config.ts index 9954d49..4814875 100644 --- a/apps/playground-web/tailwind.config.ts +++ b/apps/playground-web/tailwind.config.ts @@ -3,11 +3,6 @@ import baseConfig from '@dicedb/tailwind-config/base'; const config: Config = { ...baseConfig, - content: [ - './pages/**/*.{js,ts,jsx,tsx,mdx}', - './components/**/*.{js,ts,jsx,tsx,mdx}', - './app/**/*.{js,ts,jsx,tsx,mdx}', - ], theme: { extend: { fontFamily: { diff --git a/package.json b/package.json index 62fd8a0..4458fa9 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,10 @@ "scripts": { "build": "turbo build", "build:playground": "turbo build --filter=@dicedb/playground-web --ui stream", + "build:console": "turbo build --filter=@dicedb/console-electron --ui stream", "dev": "turbo dev", "dev:playground": "turbo dev --filter=@dicedb/playground-web --ui stream", + "dev:console": "turbo dev --filter=@dicedb/console-electron --ui stream", "lint": "turbo lint", "format": "prettier -c ./.prettierrc --write \"**/*.{js,jsx,ts,tsx,json,css}\"", "check:format": "prettier -c ./.prettierrc \"**/*.{js,jsx,ts,tsx,json,css}\"", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 44f384b..7a53ad6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: apps/console-electron: dependencies: + '@dicedb/ui': + specifier: workspace:* + version: link:../../packages/ui next: specifier: 14.2.15 version: 14.2.15(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -33,6 +36,9 @@ importers: '@dicedb/eslint-config': specifier: workspace:* version: link:../../tooling/eslint-config + '@dicedb/tailwind-config': + specifier: workspace:* + version: link:../../tooling/tailwind-config '@dicedb/typescript-config': specifier: workspace:* version: link:../../tooling/typescript-config @@ -92,7 +98,7 @@ importers: version: 0.446.0(react@18.3.1) next: specifier: 14.2.13 - version: 14.2.13(@babel/core@7.25.8)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 14.2.13(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) package.json: specifier: ^2.0.1 version: 2.0.1 @@ -5914,10 +5920,10 @@ snapshots: '@typescript-eslint/eslint-plugin': 6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1)(typescript@5.6.3) '@typescript-eslint/parser': 6.21.0(eslint@8.57.1)(typescript@5.6.3) eslint-config-prettier: 9.1.0(eslint@8.57.1) - eslint-import-resolver-alias: 1.1.2(eslint-plugin-import@2.31.0) + eslint-import-resolver-alias: 1.1.2(eslint-plugin-import@2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1)) eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1) eslint-plugin-eslint-comments: 3.2.0(eslint@8.57.1) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) eslint-plugin-jest: 27.9.0(@typescript-eslint/eslint-plugin@7.18.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1)(jest@29.7.0(@types/node@20.16.11)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@types/node@20.16.11)(typescript@5.6.3)))(typescript@5.6.3) eslint-plugin-jsx-a11y: 6.10.0(eslint@8.57.1) eslint-plugin-playwright: 0.16.0(eslint-plugin-jest@27.9.0(@typescript-eslint/eslint-plugin@6.21.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1)(jest@29.7.0(@types/node@20.16.11)(babel-plugin-macros@3.1.0)(ts-node@10.9.2(@types/node@20.16.11)(typescript@5.6.3)))(typescript@5.6.3))(eslint@8.57.1) @@ -6823,8 +6829,8 @@ snapshots: '@typescript-eslint/parser': 7.18.0(eslint@8.57.1)(typescript@5.6.3) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.1) - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) eslint-plugin-jsx-a11y: 6.10.0(eslint@8.57.1) eslint-plugin-react: 7.37.1(eslint@8.57.1) eslint-plugin-react-hooks: 5.0.0-canary-7118f5dd7-20230705(eslint@8.57.1) @@ -6844,9 +6850,9 @@ snapshots: eslint: 8.57.1 eslint-plugin-turbo: 2.1.3(eslint@8.57.1) - eslint-import-resolver-alias@1.1.2(eslint-plugin-import@2.31.0): + eslint-import-resolver-alias@1.1.2(eslint-plugin-import@2.31.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1)): dependencies: - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) eslint-import-resolver-node@0.3.9: dependencies: @@ -6862,39 +6868,39 @@ snapshots: debug: 4.3.7 enhanced-resolve: 5.17.1 eslint: 8.57.1 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1) fast-glob: 3.3.2 get-tsconfig: 4.8.1 is-bun-module: 1.2.1 is-glob: 4.0.3 optionalDependencies: - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color - eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.1): + eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1): dependencies: '@nolyfill/is-core-module': 1.0.39 debug: 4.3.7 enhanced-resolve: 5.17.1 eslint: 8.57.1 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) fast-glob: 3.3.2 get-tsconfig: 4.8.1 is-bun-module: 1.2.1 is-glob: 4.0.3 optionalDependencies: - eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) + eslint-plugin-import: 2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@6.21.0(eslint@8.57.1)(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@8.57.1))(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: @@ -6905,14 +6911,14 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1): + eslint-module-utils@2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): dependencies: debug: 3.2.7 optionalDependencies: '@typescript-eslint/parser': 7.18.0(eslint@8.57.1)(typescript@5.6.3) eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0)(eslint@8.57.1) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1) transitivePeerDependencies: - supports-color @@ -6922,7 +6928,7 @@ snapshots: eslint: 8.57.1 ignore: 5.3.2 - eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1): + eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.8 @@ -6933,7 +6939,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.1 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.31.0(@typescript-eslint/parser@7.18.0(eslint@8.57.1)(typescript@5.6.3))(eslint@8.57.1))(eslint@8.57.1))(eslint@8.57.1) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -8466,7 +8472,7 @@ snapshots: netmask@2.0.2: {} - next@14.2.13(@babel/core@7.25.8)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + next@14.2.13(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: '@next/env': 14.2.13 '@swc/helpers': 0.5.5 @@ -8476,7 +8482,7 @@ snapshots: postcss: 8.4.31 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - styled-jsx: 5.1.1(@babel/core@7.25.8)(babel-plugin-macros@3.1.0)(react@18.3.1) + styled-jsx: 5.1.1(babel-plugin-macros@3.1.0)(react@18.3.1) optionalDependencies: '@next/swc-darwin-arm64': 14.2.13 '@next/swc-darwin-x64': 14.2.13 @@ -8501,7 +8507,7 @@ snapshots: postcss: 8.4.31 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - styled-jsx: 5.1.1(@babel/core@7.25.8)(babel-plugin-macros@3.1.0)(react@18.3.1) + styled-jsx: 5.1.1(babel-plugin-macros@3.1.0)(react@18.3.1) optionalDependencies: '@next/swc-darwin-arm64': 14.2.15 '@next/swc-darwin-x64': 14.2.15 @@ -9406,12 +9412,11 @@ snapshots: strip-json-comments@3.1.1: {} - styled-jsx@5.1.1(@babel/core@7.25.8)(babel-plugin-macros@3.1.0)(react@18.3.1): + styled-jsx@5.1.1(babel-plugin-macros@3.1.0)(react@18.3.1): dependencies: client-only: 0.0.1 react: 18.3.1 optionalDependencies: - '@babel/core': 7.25.8 babel-plugin-macros: 3.1.0 stylis@4.2.0: {} diff --git a/src/lib/__tests__/api.test.ts b/src/lib/__tests__/api.test.ts deleted file mode 100644 index 5bd6590..0000000 --- a/src/lib/__tests__/api.test.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { executeShellCommandOnServer } from '../api'; -import { WebService } from '@/services/webServices'; - -// Mock WebService -jest.mock('@/services/webServices', () => ({ - WebService: { - post: jest.fn(), - }, -})); - -describe('executeShellCommandOnServer', () => { - const mockCmd = 'testCommand'; - const mockCmdOptions = { option1: 'value1' }; - const mockCmdExecURL = `/shell/exec/${mockCmd}`; - let consoleErrorSpy: jest.SpyInstance; - - beforeEach(() => { - consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {}); - }); - - afterEach(() => { - consoleErrorSpy.mockRestore(); - jest.clearAllMocks(); - }); - - it('should return data when WebService.post is successful', async () => { - const mockResponse = { data: 'Success Response' }; - (WebService.post as jest.Mock).mockResolvedValueOnce(mockResponse); - - const result = await executeShellCommandOnServer(mockCmd, mockCmdOptions); - - expect(WebService.post).toHaveBeenCalledWith( - mockCmdExecURL, - mockCmdOptions, - ); - expect(result).toEqual('Success Response'); - }); - - it('should return error message when response structure is unexpected', async () => { - const mockResponse = {}; // Simulate unexpected response structure - (WebService.post as jest.Mock).mockResolvedValueOnce(mockResponse); - - const result = await executeShellCommandOnServer(mockCmd, mockCmdOptions); - - expect(result).toBe('Error: Unexpected response structure'); - expect(WebService.post).toHaveBeenCalledWith( - mockCmdExecURL, - mockCmdOptions, - ); - }); - - it('should return error message when WebService.post throws an error', async () => { - const mockError = new Error('Network Error'); - - (WebService.post as jest.Mock).mockRejectedValueOnce(mockError); - const result = await executeShellCommandOnServer(mockCmd, mockCmdOptions); - expect(WebService.post).toHaveBeenCalledWith( - mockCmdExecURL, - mockCmdOptions, - ); - expect(result).toBe(`${mockError}`); - consoleErrorSpy.mockRestore(); - }); - - it('should log error to the console when WebService.post throws an error', async () => { - const mockError = new Error('Request Failed'); - const consoleSpy = jest - .spyOn(console, 'error') - .mockImplementation(() => {}); - (WebService.post as jest.Mock).mockRejectedValueOnce(mockError); - - await executeShellCommandOnServer(mockCmd, mockCmdOptions); - - expect(consoleSpy).toHaveBeenCalledWith( - 'Error executing command:', - mockError, - ); - consoleSpy.mockRestore(); - }); - - it('should always include the cmd parameter in the URL', async () => { - const mockResponse = { data: 'Some Response' }; - (WebService.post as jest.Mock).mockResolvedValueOnce(mockResponse); - - const result = await executeShellCommandOnServer(mockCmd, mockCmdOptions); - - expect(WebService.post).toHaveBeenCalledWith( - expect.stringContaining(`/shell/exec/${mockCmd}`), - mockCmdOptions, - ); - expect(result).toEqual('Some Response'); - }); -}); diff --git a/tooling/tailwind-config/base.tailwind.config.ts b/tooling/tailwind-config/base.tailwind.config.ts index dc3265e..d45c7a8 100644 --- a/tooling/tailwind-config/base.tailwind.config.ts +++ b/tooling/tailwind-config/base.tailwind.config.ts @@ -5,6 +5,7 @@ const config: Config = { './pages/**/*.{js,ts,jsx,tsx,mdx}', './components/**/*.{js,ts,jsx,tsx,mdx}', './app/**/*.{js,ts,jsx,tsx,mdx}', + '../../packages/ui/**/*.{js,ts,jsx,tsx,mdx}', ], theme: { extend: {