mirror of
https://github.com/meienberger/runtipi.git
synced 2024-08-17 08:00:26 +03:00
chore: update dependencies
This commit is contained in:
parent
6bc29df1d2
commit
15f63551e7
@ -18,7 +18,7 @@ const onRebuild = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const included = ['express', 'pg', '@runtipi/postgres-migrations', 'connect-redis', 'express-session'];
|
||||
const included = ['express', 'pg', '@runtipi/postgres-migrations', 'connect-redis', 'express-session', 'drizzle-orm'];
|
||||
const excluded = ['pg-native', '*required-server-files.json'];
|
||||
const external = Object.keys(pkg.dependencies || {}).filter((dep) => !included.includes(dep));
|
||||
external.push(...excluded);
|
||||
|
106
package.json
106
package.json
@ -27,7 +27,7 @@
|
||||
"test:build:amd64": "docker buildx build --platform linux/amd64 -t meienberger/runtipi:test ."
|
||||
},
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^2.9.10",
|
||||
"@hookform/resolvers": "^3.1.0",
|
||||
"@otplib/core": "^12.0.1",
|
||||
"@otplib/plugin-crypto": "^12.0.1",
|
||||
"@otplib/plugin-thirty-two": "^12.0.1",
|
||||
@ -37,56 +37,55 @@
|
||||
"@radix-ui/react-tabs": "^1.0.3",
|
||||
"@runtipi/postgres-migrations": "^5.3.0",
|
||||
"@tabler/core": "1.0.0-beta17",
|
||||
"@tabler/icons-react": "^2.11.0",
|
||||
"@tanstack/react-query": "^4.27.0",
|
||||
"@tanstack/react-query-devtools": "^4.27.0",
|
||||
"@trpc/client": "^10.16.0",
|
||||
"@trpc/next": "^10.16.0",
|
||||
"@trpc/react-query": "^10.16.0",
|
||||
"@trpc/server": "^10.16.0",
|
||||
"@tabler/icons-react": "^2.19.0",
|
||||
"@tanstack/react-query": "^4.29.7",
|
||||
"@tanstack/react-query-devtools": "^4.29.7",
|
||||
"@trpc/client": "^10.27.1",
|
||||
"@trpc/next": "^10.27.1",
|
||||
"@trpc/react-query": "^10.27.1",
|
||||
"@trpc/server": "^10.27.1",
|
||||
"argon2": "^0.30.3",
|
||||
"clsx": "^1.1.1",
|
||||
"connect-redis": "^7.0.1",
|
||||
"drizzle-orm": "^0.24.1",
|
||||
"connect-redis": "^7.1.0",
|
||||
"drizzle-orm": "^0.26.0",
|
||||
"express": "^4.17.3",
|
||||
"express-session": "^1.17.3",
|
||||
"fs-extra": "^11.1.0",
|
||||
"fs-extra": "^11.1.1",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"next": "13.2.4",
|
||||
"next-intl": "^2.13.1",
|
||||
"next": "13.4.3",
|
||||
"next-intl": "^2.14.2",
|
||||
"node-cron": "^3.0.1",
|
||||
"node-fetch-commonjs": "^3.2.4",
|
||||
"nookies": "^2.5.2",
|
||||
"pg": "^8.10.0",
|
||||
"pg": "^8.11.0",
|
||||
"qrcode.react": "^3.1.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-hook-form": "^7.43.7",
|
||||
"react-hot-toast": "^2.4.0",
|
||||
"react-markdown": "^8.0.3",
|
||||
"react-select": "^5.6.1",
|
||||
"react-tooltip": "^5.10.5",
|
||||
"redis": "^4.6.5",
|
||||
"remark-breaks": "^3.0.2",
|
||||
"react-hook-form": "^7.43.9",
|
||||
"react-hot-toast": "^2.4.1",
|
||||
"react-markdown": "^8.0.7",
|
||||
"react-select": "^5.7.3",
|
||||
"react-tooltip": "^5.13.1",
|
||||
"redis": "^4.6.6",
|
||||
"remark-breaks": "^3.0.3",
|
||||
"remark-gfm": "^3.0.1",
|
||||
"sass": "^1.59.3",
|
||||
"semver": "^7.3.7",
|
||||
"sass": "^1.62.1",
|
||||
"semver": "^7.5.1",
|
||||
"sharp": "0.31.3",
|
||||
"superjson": "^1.12.0",
|
||||
"tslib": "^2.4.0",
|
||||
"superjson": "^1.12.3",
|
||||
"tslib": "^2.5.2",
|
||||
"uuid": "^9.0.0",
|
||||
"validator": "^13.7.0",
|
||||
"web-push": "^3.5.0",
|
||||
"web-push": "^3.6.1",
|
||||
"winston": "^3.7.2",
|
||||
"zod": "^3.21.4",
|
||||
"zustand": "^4.3.6"
|
||||
"zustand": "^4.3.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.21.3",
|
||||
"@faker-js/faker": "^7.6.0",
|
||||
"@testing-library/dom": "^9.0.1",
|
||||
"@babel/core": "^7.21.8",
|
||||
"@faker-js/faker": "^8.0.1",
|
||||
"@testing-library/dom": "^9.3.0",
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"@testing-library/user-event": "^14.4.3",
|
||||
@ -96,49 +95,48 @@
|
||||
"@types/express-session": "^1.17.7",
|
||||
"@types/fs-extra": "^11.0.1",
|
||||
"@types/isomorphic-fetch": "^0.0.36",
|
||||
"@types/jest": "^29.5.0",
|
||||
"@types/jsonwebtoken": "^9.0.0",
|
||||
"@types/jest": "^29.5.1",
|
||||
"@types/lodash.merge": "^4.6.7",
|
||||
"@types/node": "18.15.3",
|
||||
"@types/node": "20.2.1",
|
||||
"@types/node-cron": "^3.0.2",
|
||||
"@types/pg": "^8.6.6",
|
||||
"@types/react": "18.0.28",
|
||||
"@types/react-dom": "18.0.11",
|
||||
"@types/semver": "^7.3.12",
|
||||
"@types/react": "18.2.6",
|
||||
"@types/react-dom": "18.2.4",
|
||||
"@types/semver": "^7.5.0",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"@types/testing-library__jest-dom": "^5.14.5",
|
||||
"@types/uuid": "^9.0.1",
|
||||
"@types/validator": "^13.7.14",
|
||||
"@types/validator": "^13.7.17",
|
||||
"@types/web-push": "^3.3.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
||||
"@typescript-eslint/parser": "^5.55.0",
|
||||
"dotenv-cli": "^7.1.0",
|
||||
"drizzle-kit": "^0.17.4",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.6",
|
||||
"@typescript-eslint/parser": "^5.59.6",
|
||||
"dotenv-cli": "^7.2.1",
|
||||
"drizzle-kit": "^0.18.0",
|
||||
"esbuild": "^0.16.17",
|
||||
"eslint": "8.36.0",
|
||||
"eslint": "8.41.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-airbnb-typescript": "^17.0.0",
|
||||
"eslint-config-next": "13.2.4",
|
||||
"eslint-config-prettier": "^8.7.0",
|
||||
"eslint-import-resolver-typescript": "^3.5.3",
|
||||
"eslint-config-next": "13.4.3",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"eslint-import-resolver-typescript": "^3.5.5",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-jest": "^27.1.7",
|
||||
"eslint-plugin-jest-dom": "^4.0.3",
|
||||
"eslint-plugin-jsdoc": "^40.1.0",
|
||||
"eslint-plugin-jsdoc": "^44.2.4",
|
||||
"eslint-plugin-jsx-a11y": "^6.6.1",
|
||||
"eslint-plugin-react": "^7.31.10",
|
||||
"eslint-plugin-react-hooks": "^4.6.0",
|
||||
"eslint-plugin-testing-library": "^5.10.3",
|
||||
"eslint-plugin-testing-library": "^5.11.0",
|
||||
"jest": "^29.5.0",
|
||||
"jest-environment-jsdom": "^29.5.0",
|
||||
"msw": "^1.1.0",
|
||||
"next-router-mock": "^0.9.2",
|
||||
"nodemon": "^2.0.21",
|
||||
"prettier": "^2.8.4",
|
||||
"msw": "^1.2.1",
|
||||
"next-router-mock": "^0.9.3",
|
||||
"nodemon": "^2.0.22",
|
||||
"prettier": "^2.8.8",
|
||||
"supertest": "^6.3.3",
|
||||
"ts-jest": "^29.0.3",
|
||||
"ts-jest": "^29.1.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "5.0.2",
|
||||
"typescript": "5.0.4",
|
||||
"wait-for-expect": "^3.0.2",
|
||||
"whatwg-fetch": "^3.6.2"
|
||||
},
|
||||
|
1744
pnpm-lock.yaml
1744
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
||||
/* tslint:disable */
|
||||
|
||||
/**
|
||||
* Mock Service Worker (1.1.0).
|
||||
* Mock Service Worker (1.2.1).
|
||||
* @see https://github.com/mswjs/msw
|
||||
* - Please do NOT modify this file.
|
||||
* - Please do NOT serve this file on production.
|
||||
|
@ -6,7 +6,7 @@ import { fireEvent, render, screen } from '../../../../../tests/test-utils';
|
||||
describe('<OtpInput />', () => {
|
||||
it('should accept value & valueLength props', () => {
|
||||
// arrange
|
||||
const value = faker.datatype.number({ min: 0, max: 999999 }).toString();
|
||||
const value = faker.number.int({ min: 0, max: 999999 }).toString();
|
||||
const valueArray = value.split('');
|
||||
const valueLength = value.length;
|
||||
render(<OtpInput value={value} valueLength={valueLength} onChange={() => {}} />);
|
||||
@ -22,7 +22,7 @@ describe('<OtpInput />', () => {
|
||||
|
||||
it('should allow typing of digits', () => {
|
||||
// arrange
|
||||
const valueLength = faker.datatype.number({ min: 2, max: 6 }); // random number from 2-6 (minimum 2 so it can focus on the next input)
|
||||
const valueLength = faker.number.int({ min: 2, max: 6 }); // random number from 2-6 (minimum 2 so it can focus on the next input)
|
||||
const onChange = jest.fn();
|
||||
render(<OtpInput valueLength={valueLength} onChange={onChange} value="" />);
|
||||
|
||||
@ -31,7 +31,7 @@ describe('<OtpInput />', () => {
|
||||
// assert
|
||||
expect(inputEls).toHaveLength(valueLength);
|
||||
inputEls.forEach((inputEl, idx) => {
|
||||
const digit = faker.datatype.number({ min: 0, max: 9 }).toString(); // random number from 0-9, typing of digits is 1 by 1
|
||||
const digit = faker.number.int({ min: 0, max: 9 }).toString(); // random number from 0-9, typing of digits is 1 by 1
|
||||
|
||||
// trigger a change event
|
||||
fireEvent.change(inputEl, {
|
||||
@ -50,7 +50,7 @@ describe('<OtpInput />', () => {
|
||||
|
||||
it('should NOT allow typing of non-digits', () => {
|
||||
// arrange
|
||||
const valueLength = faker.datatype.number({ min: 2, max: 6 });
|
||||
const valueLength = faker.number.int({ min: 2, max: 6 });
|
||||
const onChange = jest.fn();
|
||||
render(<OtpInput valueLength={valueLength} onChange={onChange} value="" />);
|
||||
|
||||
@ -60,7 +60,7 @@ describe('<OtpInput />', () => {
|
||||
expect(inputEls).toHaveLength(valueLength);
|
||||
|
||||
inputEls.forEach((inputEl) => {
|
||||
const nonDigit = faker.random.alpha(1);
|
||||
const nonDigit = faker.number.float(1);
|
||||
|
||||
fireEvent.change(inputEl, {
|
||||
target: { value: nonDigit },
|
||||
@ -73,7 +73,7 @@ describe('<OtpInput />', () => {
|
||||
});
|
||||
|
||||
it('should allow deleting of digits (focus on previous element)', () => {
|
||||
const value = faker.datatype.number({ min: 10, max: 999999 }).toString(); // minimum 2-digit so it can focus on the previous input
|
||||
const value = faker.number.int({ min: 10, max: 999999 }).toString(); // minimum 2-digit so it can focus on the previous input
|
||||
const valueLength = value.length;
|
||||
const lastIdx = valueLength - 1;
|
||||
const onChange = jest.fn();
|
||||
@ -117,7 +117,7 @@ describe('<OtpInput />', () => {
|
||||
});
|
||||
|
||||
it('should allow deleting of digits (do NOT focus on previous element)', () => {
|
||||
const value = faker.datatype.number({ min: 10, max: 999999 }).toString();
|
||||
const value = faker.number.int({ min: 10, max: 999999 }).toString();
|
||||
const valueArray = value.split('');
|
||||
const valueLength = value.length;
|
||||
const lastIdx = valueLength - 1;
|
||||
@ -147,7 +147,7 @@ describe('<OtpInput />', () => {
|
||||
});
|
||||
|
||||
it('should NOT allow deleting of digits in the middle', () => {
|
||||
const value = faker.datatype.number({ min: 100000, max: 999999 }).toString();
|
||||
const value = faker.number.int({ min: 100000, max: 999999 }).toString();
|
||||
const valueLength = value.length;
|
||||
const onChange = jest.fn();
|
||||
|
||||
@ -167,7 +167,7 @@ describe('<OtpInput />', () => {
|
||||
});
|
||||
|
||||
it('should allow pasting of digits (same length as valueLength)', () => {
|
||||
const value = faker.datatype.number({ min: 10, max: 999999 }).toString(); // minimum 2-digit so it is considered as a paste event
|
||||
const value = faker.number.int({ min: 10, max: 999999 }).toString(); // minimum 2-digit so it is considered as a paste event
|
||||
const valueLength = value.length;
|
||||
const onChange = jest.fn();
|
||||
|
||||
@ -176,7 +176,7 @@ describe('<OtpInput />', () => {
|
||||
const inputEls = screen.queryAllByRole('textbox');
|
||||
|
||||
// get a random input element from the input elements to paste the digits on
|
||||
const randomIdx = faker.datatype.number({ min: 0, max: valueLength - 1 });
|
||||
const randomIdx = faker.number.int({ min: 0, max: valueLength - 1 });
|
||||
const randomInputEl = inputEls[randomIdx] as HTMLInputElement;
|
||||
|
||||
fireEvent.change(randomInputEl, { target: { value } });
|
||||
@ -188,14 +188,14 @@ describe('<OtpInput />', () => {
|
||||
});
|
||||
|
||||
it('should NOT allow pasting of digits (less than valueLength)', () => {
|
||||
const value = faker.datatype.number({ min: 10, max: 99999 }).toString(); // random 2-5 digit code (less than "valueLength")
|
||||
const valueLength = faker.datatype.number({ min: 6, max: 10 }); // random number from 6-10
|
||||
const value = faker.number.int({ min: 10, max: 99999 }).toString(); // random 2-5 digit code (less than "valueLength")
|
||||
const valueLength = faker.number.int({ min: 6, max: 10 }); // random number from 6-10
|
||||
const onChange = jest.fn();
|
||||
|
||||
render(<OtpInput valueLength={valueLength} onChange={onChange} value="" />);
|
||||
|
||||
const inputEls = screen.queryAllByRole('textbox');
|
||||
const randomIdx = faker.datatype.number({ min: 0, max: valueLength - 1 });
|
||||
const randomIdx = faker.number.int({ min: 0, max: valueLength - 1 });
|
||||
const randomInputEl = inputEls[randomIdx] as HTMLInputElement;
|
||||
|
||||
fireEvent.change(randomInputEl, { target: { value } });
|
||||
|
@ -5,22 +5,22 @@ import { App, AppCategory, AppInfo, AppWithInfo } from '../../core/types';
|
||||
|
||||
const randomCategory = (): AppCategory[] => {
|
||||
const categories = Object.values(APP_CATEGORIES);
|
||||
const randomIndex = faker.datatype.number({ min: 0, max: categories.length - 1 });
|
||||
const randomIndex = faker.number.int({ min: 0, max: categories.length - 1 });
|
||||
return [categories[randomIndex] as AppCategory];
|
||||
};
|
||||
|
||||
export const createApp = (overrides?: Partial<AppInfo>): AppInfo => {
|
||||
const name = faker.random.word();
|
||||
const name = faker.lorem.word();
|
||||
return {
|
||||
id: name.toLowerCase(),
|
||||
name,
|
||||
description: faker.random.words(),
|
||||
author: faker.random.word(),
|
||||
description: faker.lorem.words(),
|
||||
author: faker.lorem.word(),
|
||||
available: true,
|
||||
categories: randomCategory(),
|
||||
form_fields: [],
|
||||
port: faker.datatype.number({ min: 1000, max: 9999 }),
|
||||
short_desc: faker.random.words(),
|
||||
port: faker.number.int({ min: 1000, max: 9999 }),
|
||||
short_desc: faker.lorem.words(),
|
||||
tipi_version: 1,
|
||||
version: faker.system.semver(),
|
||||
source: faker.internet.url(),
|
||||
@ -43,7 +43,7 @@ type CreateAppEntityParams = {
|
||||
export const createAppEntity = (params: CreateAppEntityParams): AppWithInfo => {
|
||||
const { overrides, overridesInfo, status = 'running' } = params;
|
||||
|
||||
const id = faker.random.word().toLowerCase();
|
||||
const id = faker.lorem.word().toLowerCase();
|
||||
const app = createApp({ id, ...overridesInfo });
|
||||
return {
|
||||
id,
|
||||
|
@ -57,7 +57,7 @@ export const handlers = [
|
||||
type: 'query',
|
||||
response: {
|
||||
totpEnabled: false,
|
||||
id: faker.datatype.number(),
|
||||
id: faker.number.int(),
|
||||
username: faker.internet.userName(),
|
||||
locale: 'en',
|
||||
},
|
||||
|
@ -75,7 +75,7 @@ describe('Test: InstallForm', () => {
|
||||
});
|
||||
|
||||
it('should pre-fill fields if initialValues are provided', () => {
|
||||
const selectValue = faker.random.word();
|
||||
const selectValue = faker.lorem.word();
|
||||
|
||||
const formFields: FormField[] = [
|
||||
{ env_variable: 'test-env', label: 'test-field', type: 'text', required: true },
|
||||
|
@ -101,7 +101,7 @@ describe('Test: LoginContainer', () => {
|
||||
// arrange
|
||||
const email = faker.internet.email();
|
||||
const password = faker.internet.password();
|
||||
const totpSessionId = faker.datatype.uuid();
|
||||
const totpSessionId = faker.string.uuid();
|
||||
server.use(
|
||||
getTRPCMock({
|
||||
path: ['auth', 'login'],
|
||||
@ -130,7 +130,7 @@ describe('Test: LoginContainer', () => {
|
||||
// arrange
|
||||
const email = faker.internet.email();
|
||||
const password = faker.internet.password();
|
||||
const totpSessionId = faker.datatype.uuid();
|
||||
const totpSessionId = faker.string.uuid();
|
||||
server.use(getTRPCMock({ path: ['auth', 'login'], type: 'mutation', response: { totpSessionId } }));
|
||||
server.use(getTRPCMockError({ path: ['auth', 'verifyTotp'], type: 'mutation', status: 500, message: 'Invalid totp code' }));
|
||||
render(<LoginContainer />);
|
||||
@ -167,7 +167,7 @@ describe('Test: LoginContainer', () => {
|
||||
// arrange
|
||||
const email = faker.internet.email();
|
||||
const password = faker.internet.password();
|
||||
const totpSessionId = faker.datatype.uuid();
|
||||
const totpSessionId = faker.string.uuid();
|
||||
server.use(getTRPCMock({ path: ['auth', 'login'], type: 'mutation', response: { totpSessionId } }));
|
||||
server.use(getTRPCMock({ path: ['auth', 'verifyTotp'], type: 'mutation', response: true }));
|
||||
render(<LoginContainer />);
|
||||
|
@ -8,17 +8,17 @@ describe('Test: Dashboard', () => {
|
||||
it('should render', () => {
|
||||
const data: SystemRouterOutput['systemInfo'] = {
|
||||
disk: {
|
||||
available: faker.datatype.number(),
|
||||
total: faker.datatype.number(),
|
||||
used: faker.datatype.number(),
|
||||
available: faker.number.int(),
|
||||
total: faker.number.int(),
|
||||
used: faker.number.int(),
|
||||
},
|
||||
memory: {
|
||||
available: faker.datatype.number(),
|
||||
total: faker.datatype.number(),
|
||||
used: faker.datatype.number(),
|
||||
available: faker.number.int(),
|
||||
total: faker.number.int(),
|
||||
used: faker.number.int(),
|
||||
},
|
||||
cpu: {
|
||||
load: faker.datatype.number(),
|
||||
load: faker.number.int(),
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -13,7 +13,7 @@ describe('<ChangePasswordForm />', () => {
|
||||
const currentPasswordInput = screen.getByRole('textbox', { name: 'currentPassword' });
|
||||
const newPasswordInput = screen.getByRole('textbox', { name: 'newPassword' });
|
||||
const confirmPasswordInput = screen.getByRole('textbox', { name: 'newPasswordConfirm' });
|
||||
const newPassword = faker.random.alphaNumeric(8);
|
||||
const newPassword = faker.string.alphanumeric(8);
|
||||
|
||||
// act
|
||||
fireEvent.change(currentPasswordInput, { target: { value: 'test' } });
|
||||
@ -35,10 +35,10 @@ describe('<ChangePasswordForm />', () => {
|
||||
const currentPasswordInput = screen.getByRole('textbox', { name: 'currentPassword' });
|
||||
const newPasswordInput = screen.getByRole('textbox', { name: 'newPassword' });
|
||||
const confirmPasswordInput = screen.getByRole('textbox', { name: 'newPasswordConfirm' });
|
||||
const newPassword = faker.random.alphaNumeric(8);
|
||||
const newPassword = faker.string.alphanumeric(8);
|
||||
|
||||
// act
|
||||
fireEvent.change(currentPasswordInput, { target: { value: faker.random.alphaNumeric(8) } });
|
||||
fireEvent.change(currentPasswordInput, { target: { value: faker.string.alphanumeric(8) } });
|
||||
fireEvent.change(newPasswordInput, { target: { value: newPassword } });
|
||||
fireEvent.change(confirmPasswordInput, { target: { value: newPassword } });
|
||||
const submitButton = screen.getByRole('button', { name: /Change password/i });
|
||||
@ -59,8 +59,8 @@ describe('<ChangePasswordForm />', () => {
|
||||
|
||||
// act
|
||||
fireEvent.change(currentPasswordInput, { target: { value: 'test' } });
|
||||
fireEvent.change(newPasswordInput, { target: { value: faker.random.alphaNumeric(8) } });
|
||||
fireEvent.change(confirmPasswordInput, { target: { value: faker.random.alphaNumeric(8) } });
|
||||
fireEvent.change(newPasswordInput, { target: { value: faker.string.alphanumeric(8) } });
|
||||
fireEvent.change(confirmPasswordInput, { target: { value: faker.string.alphanumeric(8) } });
|
||||
const submitButton = screen.getByRole('button', { name: /Change password/i });
|
||||
submitButton.click();
|
||||
|
||||
|
@ -56,8 +56,8 @@ describe('Test: getConfig', () => {
|
||||
// arrange
|
||||
const settingsJson = {
|
||||
appsRepoUrl: faker.internet.url(),
|
||||
appsRepoId: faker.random.word(),
|
||||
domain: faker.random.word(),
|
||||
appsRepoId: faker.lorem.word(),
|
||||
domain: faker.lorem.word(),
|
||||
};
|
||||
const MockFiles = {
|
||||
'/runtipi/state/settings.json': JSON.stringify(settingsJson),
|
||||
@ -78,8 +78,8 @@ describe('Test: getConfig', () => {
|
||||
it('Should not be able to apply an invalid value from json config', () => {
|
||||
// arrange
|
||||
const settingsJson = {
|
||||
appsRepoUrl: faker.random.word(),
|
||||
appsRepoId: faker.random.word(),
|
||||
appsRepoUrl: faker.lorem.word(),
|
||||
appsRepoId: faker.lorem.word(),
|
||||
domain: 10,
|
||||
};
|
||||
const MockFiles = {
|
||||
|
@ -43,7 +43,7 @@ describe('Test: checkAppRequirements()', () => {
|
||||
it('Should throw if architecture is not supported', async () => {
|
||||
// arrange
|
||||
setConfig('architecture', 'arm64');
|
||||
const appConfig = await createAppConfig({ supported_architectures: ['arm'] });
|
||||
const appConfig = createAppConfig({ supported_architectures: ['arm'] });
|
||||
|
||||
// assert
|
||||
expect(() => checkAppRequirements(appConfig.id)).toThrowError(`App ${appConfig.id} is not supported on this architecture`);
|
||||
@ -76,7 +76,7 @@ describe('Test: checkEnvFile()', () => {
|
||||
|
||||
it('Should throw if a required field is missing', async () => {
|
||||
// arrange
|
||||
const fieldName = faker.random.word().toUpperCase();
|
||||
const fieldName = faker.lorem.word().toUpperCase();
|
||||
const appConfig = createAppConfig({ form_fields: [{ env_variable: fieldName, type: 'text', label: 'test', required: true }] });
|
||||
const app = await insertApp({}, appConfig, db);
|
||||
const newAppEnv = 'APP_PORT=test\n';
|
||||
@ -138,7 +138,7 @@ describe('Test: generateEnvFile()', () => {
|
||||
// arrange
|
||||
const appConfig = createAppConfig({ form_fields: [{ env_variable: 'TEST_FIELD', type: 'text', label: 'test', required: true }] });
|
||||
const app = await insertApp({}, appConfig, db);
|
||||
const fakevalue = faker.random.alphaNumeric(10);
|
||||
const fakevalue = faker.string.alphanumeric(10);
|
||||
|
||||
// act
|
||||
generateEnvFile(Object.assign(app, { config: { TEST_FIELD: fakevalue } }));
|
||||
@ -166,7 +166,7 @@ describe('Test: generateEnvFile()', () => {
|
||||
// arrange
|
||||
const appConfig = createAppConfig({ form_fields: [{ env_variable: 'RANDOM_FIELD', type: 'random', label: 'test', min: 32, max: 32, required: true }] });
|
||||
const app = await insertApp({}, appConfig, db);
|
||||
const randomField = faker.random.alphaNumeric(32);
|
||||
const randomField = faker.string.alphanumeric(32);
|
||||
fs.writeFileSync(`/app/storage/app-data/${app.id}/app.env`, `RANDOM_FIELD=${randomField}`);
|
||||
|
||||
// act
|
||||
@ -279,8 +279,8 @@ describe('Test: generateEnvFile()', () => {
|
||||
const appConfig = createAppConfig({ generate_vapid_keys: true });
|
||||
const app = await insertApp({}, appConfig, db);
|
||||
|
||||
const vapidPrivateKey = faker.random.alphaNumeric(32);
|
||||
const vapidPublicKey = faker.random.alphaNumeric(32);
|
||||
const vapidPrivateKey = faker.string.alphanumeric(32);
|
||||
const vapidPublicKey = faker.string.alphanumeric(32);
|
||||
|
||||
// act
|
||||
fs.writeFileSync(`/app/storage/app-data/${app.id}/app.env`, `VAPID_PRIVATE_KEY=${vapidPrivateKey}\nVAPID_PUBLIC_KEY=${vapidPublicKey}`);
|
||||
@ -386,7 +386,7 @@ describe('Test: getAppInfo()', () => {
|
||||
|
||||
it('Should return null if app does not exist', async () => {
|
||||
// arrange
|
||||
const app = getAppInfo(faker.random.word());
|
||||
const app = getAppInfo(faker.lorem.word());
|
||||
|
||||
// assert
|
||||
expect(app).toBeNull();
|
||||
@ -408,7 +408,7 @@ describe('Test: getUpdateInfo()', () => {
|
||||
|
||||
it('Should return default values if app is not installed', async () => {
|
||||
// arrange
|
||||
const updateInfo = getUpdateInfo(faker.random.word());
|
||||
const updateInfo = getUpdateInfo(faker.lorem.word());
|
||||
|
||||
// assert
|
||||
expect(updateInfo).toEqual({ latestVersion: 0, latestDockerVersion: '0.0.0' });
|
||||
@ -483,7 +483,7 @@ describe('Test: ensureAppFolder()', () => {
|
||||
|
||||
it('Should delete folder if it exists but has no docker-compose.yml file', () => {
|
||||
// arrange
|
||||
const randomFileName = `${faker.random.word()}.yml`;
|
||||
const randomFileName = `${faker.lorem.word()}.yml`;
|
||||
const mockFiles = {
|
||||
[`/runtipi/repos/repo-id/apps/test`]: [randomFileName],
|
||||
'/runtipi/apps/test': ['test.yml'],
|
||||
|
@ -388,7 +388,7 @@ describe('Update app config', () => {
|
||||
// arrange
|
||||
const appConfig = createAppConfig({ form_fields: [{ type: 'text', label: '', required: true, env_variable: 'TEST_FIELD' }] });
|
||||
await insertApp({}, appConfig, db);
|
||||
const word = faker.random.word();
|
||||
const word = faker.lorem.word();
|
||||
|
||||
// act
|
||||
await AppsService.updateAppConfig(appConfig.id, { TEST_FIELD: word });
|
||||
@ -413,7 +413,7 @@ describe('Update app config', () => {
|
||||
|
||||
it('Should not recreate random field if already present in .env', async () => {
|
||||
// arrange
|
||||
const field = faker.random.word();
|
||||
const field = faker.lorem.word();
|
||||
const appConfig = createAppConfig({ form_fields: [{ type: 'random', label: '', required: false, env_variable: field }] });
|
||||
await insertApp({}, appConfig, db);
|
||||
|
||||
@ -522,8 +522,8 @@ describe('Get app config', () => {
|
||||
describe('List apps', () => {
|
||||
it('Should correctly list apps sorted by id', async () => {
|
||||
// arrange
|
||||
const randomName1 = faker.random.word();
|
||||
const randomName2 = faker.random.word();
|
||||
const randomName1 = faker.lorem.word();
|
||||
const randomName2 = faker.lorem.word();
|
||||
const sortedNames = [randomName1, randomName2].sort((a, b) => a.localeCompare(b));
|
||||
|
||||
const appConfig = createAppConfig({ id: randomName1.toLowerCase(), name: randomName1 });
|
||||
|
@ -78,7 +78,7 @@ describe('Test: verifyTotp', () => {
|
||||
// arrange
|
||||
const req = { session: { userId: undefined } };
|
||||
const email = faker.internet.email();
|
||||
const salt = faker.random.word();
|
||||
const salt = faker.lorem.word();
|
||||
const totpSecret = TotpAuthenticator.generateSecret();
|
||||
|
||||
const encryptedTotpSecret = encrypt(totpSecret, salt);
|
||||
@ -102,7 +102,7 @@ describe('Test: verifyTotp', () => {
|
||||
it('should throw if the totp is incorrect', async () => {
|
||||
// arrange
|
||||
const email = faker.internet.email();
|
||||
const salt = faker.random.word();
|
||||
const salt = faker.lorem.word();
|
||||
const totpSecret = TotpAuthenticator.generateSecret();
|
||||
const encryptedTotpSecret = encrypt(totpSecret, salt);
|
||||
const user = await createUser({ email, totpEnabled: true, totpSecret: encryptedTotpSecret, salt }, database);
|
||||
@ -116,7 +116,7 @@ describe('Test: verifyTotp', () => {
|
||||
it('should throw if the totpSessionId is invalid', async () => {
|
||||
// arrange
|
||||
const email = faker.internet.email();
|
||||
const salt = faker.random.word();
|
||||
const salt = faker.lorem.word();
|
||||
const totpSecret = TotpAuthenticator.generateSecret();
|
||||
const encryptedTotpSecret = encrypt(totpSecret, salt);
|
||||
const user = await createUser({ email, totpEnabled: true, totpSecret: encryptedTotpSecret, salt }, database);
|
||||
@ -141,7 +141,7 @@ describe('Test: verifyTotp', () => {
|
||||
it('should throw if the user totpEnabled is false', async () => {
|
||||
// arrange
|
||||
const email = faker.internet.email();
|
||||
const salt = faker.random.word();
|
||||
const salt = faker.lorem.word();
|
||||
const totpSecret = TotpAuthenticator.generateSecret();
|
||||
const encryptedTotpSecret = encrypt(totpSecret, salt);
|
||||
const user = await createUser({ email, totpEnabled: false, totpSecret: encryptedTotpSecret, salt }, database);
|
||||
@ -191,7 +191,7 @@ describe('Test: getTotpUri', () => {
|
||||
it('should regenerate a new totp secret if the user already has one', async () => {
|
||||
// arrange
|
||||
const email = faker.internet.email();
|
||||
const salt = faker.random.word();
|
||||
const salt = faker.lorem.word();
|
||||
const totpSecret = TotpAuthenticator.generateSecret();
|
||||
const encryptedTotpSecret = encrypt(totpSecret, salt);
|
||||
const user = await createUser({ email, totpSecret: encryptedTotpSecret, salt }, database);
|
||||
@ -251,7 +251,7 @@ describe('Test: setupTotp', () => {
|
||||
// arrange
|
||||
const email = faker.internet.email();
|
||||
const totpSecret = TotpAuthenticator.generateSecret();
|
||||
const salt = faker.random.word();
|
||||
const salt = faker.lorem.word();
|
||||
const encryptedTotpSecret = encrypt(totpSecret, salt);
|
||||
|
||||
const user = await createUser({ email, totpSecret: encryptedTotpSecret, salt }, database);
|
||||
@ -289,7 +289,7 @@ describe('Test: setupTotp', () => {
|
||||
// arrange
|
||||
const email = faker.internet.email();
|
||||
const totpSecret = TotpAuthenticator.generateSecret();
|
||||
const salt = faker.random.word();
|
||||
const salt = faker.lorem.word();
|
||||
const encryptedTotpSecret = encrypt(totpSecret, salt);
|
||||
|
||||
const user = await createUser({ email, totpSecret: encryptedTotpSecret, salt }, database);
|
||||
@ -676,7 +676,7 @@ describe('Test: changePassword', () => {
|
||||
const email = faker.internet.email();
|
||||
const user = await createUser({ email }, database);
|
||||
const newPassword = faker.internet.password();
|
||||
await TipiCache.set(`session:${user.id}:${faker.random.word()}`, 'test');
|
||||
await TipiCache.set(`session:${user.id}:${faker.lorem.word()}`, 'test');
|
||||
|
||||
// act
|
||||
await AuthService.changePassword({ userId: user.id, newPassword, currentPassword: 'password' });
|
||||
|
@ -73,9 +73,9 @@ describe('Test: getVersion', () => {
|
||||
|
||||
it('It should return version with body', async () => {
|
||||
// Arrange
|
||||
const body = faker.random.words(10);
|
||||
const body = faker.lorem.words(10);
|
||||
// @ts-expect-error Mocking fetch
|
||||
fetch.mockImplementationOnce(() => Promise.resolve({ json: () => Promise.resolve({ name: `v${faker.random.numeric(1)}.${faker.random.numeric(1)}.${faker.random.numeric()}`, body }) }));
|
||||
fetch.mockImplementationOnce(() => Promise.resolve({ json: () => Promise.resolve({ name: `v${faker.string.numeric(1)}.${faker.string.numeric(1)}.${faker.string.numeric()}`, body }) }));
|
||||
|
||||
// Act
|
||||
const version = await SystemService.getVersion();
|
||||
@ -101,7 +101,7 @@ describe('Test: getVersion', () => {
|
||||
it('Should return cached version', async () => {
|
||||
// Arrange
|
||||
// @ts-expect-error Mocking fetch
|
||||
fetch.mockImplementationOnce(() => Promise.resolve({ json: () => Promise.resolve({ name: `v${faker.random.numeric(1)}.${faker.random.numeric(1)}.${faker.random.numeric()}` }) }));
|
||||
fetch.mockImplementationOnce(() => Promise.resolve({ json: () => Promise.resolve({ name: `v${faker.string.numeric(1)}.${faker.string.numeric(1)}.${faker.string.numeric()}` }) }));
|
||||
|
||||
// Act
|
||||
const version = await SystemService.getVersion();
|
||||
|
@ -24,14 +24,14 @@ const createAppConfig = (props?: Partial<AppInfo>) => {
|
||||
const mockFiles: Record<string, string | string[]> = {};
|
||||
|
||||
const appInfo = appInfoSchema.parse({
|
||||
id: faker.random.alphaNumeric(32),
|
||||
id: faker.string.alphanumeric(32),
|
||||
available: true,
|
||||
port: faker.datatype.number({ min: 30, max: 65535 }),
|
||||
name: faker.random.alphaNumeric(32),
|
||||
description: faker.random.alphaNumeric(32),
|
||||
port: faker.number.int({ min: 30, max: 65535 }),
|
||||
name: faker.string.alphanumeric(32),
|
||||
description: faker.string.alphanumeric(32),
|
||||
tipi_version: 1,
|
||||
short_desc: faker.random.alphaNumeric(32),
|
||||
author: faker.random.alphaNumeric(32),
|
||||
short_desc: faker.string.alphanumeric(32),
|
||||
author: faker.string.alphanumeric(32),
|
||||
source: faker.internet.url(),
|
||||
categories: [APP_CATEGORIES.AUTOMATION],
|
||||
...props,
|
||||
@ -64,31 +64,31 @@ const createApp = async (props: IProps, database: TestDatabase) => {
|
||||
|
||||
const categories = Object.values(APP_CATEGORIES);
|
||||
|
||||
const randomId = faker.random.alphaNumeric(32);
|
||||
const randomId = faker.string.alphanumeric(32);
|
||||
|
||||
const appInfo: AppInfo = {
|
||||
id: randomId,
|
||||
port: faker.datatype.number({ min: 3000, max: 5000 }),
|
||||
port: faker.number.int({ min: 3000, max: 5000 }),
|
||||
available: true,
|
||||
form_fields: [
|
||||
{
|
||||
type: 'text',
|
||||
label: faker.random.word(),
|
||||
label: faker.lorem.word(),
|
||||
required: true,
|
||||
env_variable: 'TEST_FIELD',
|
||||
},
|
||||
],
|
||||
name: faker.random.word(),
|
||||
description: faker.random.words(),
|
||||
tipi_version: faker.datatype.number({ min: 1, max: 10 }),
|
||||
short_desc: faker.random.words(),
|
||||
name: faker.lorem.word(),
|
||||
description: faker.lorem.words(),
|
||||
tipi_version: faker.number.int({ min: 1, max: 10 }),
|
||||
short_desc: faker.lorem.words(),
|
||||
author: faker.name.firstName(),
|
||||
source: faker.internet.url(),
|
||||
categories: [categories[faker.datatype.number({ min: 0, max: categories.length - 1 })]] as AppInfo['categories'],
|
||||
categories: [categories[faker.number.int({ min: 0, max: categories.length - 1 })]] as AppInfo['categories'],
|
||||
exposable,
|
||||
force_expose: forceExpose,
|
||||
supported_architectures: supportedArchitectures,
|
||||
version: String(faker.datatype.number({ min: 1, max: 10 })),
|
||||
version: String(faker.number.int({ min: 1, max: 10 })),
|
||||
https: false,
|
||||
no_gui: false,
|
||||
generate_vapid_keys: generateVapidKeys,
|
||||
@ -98,7 +98,7 @@ const createApp = async (props: IProps, database: TestDatabase) => {
|
||||
appInfo.form_fields?.push({
|
||||
required: false,
|
||||
type: 'random',
|
||||
label: faker.random.word(),
|
||||
label: faker.lorem.word(),
|
||||
env_variable: 'RANDOM_FIELD',
|
||||
});
|
||||
}
|
||||
|
@ -5,9 +5,9 @@ import { encrypt, decrypt } from '../encryption';
|
||||
describe('Test: encrypt', () => {
|
||||
it('should encrypt the provided data', () => {
|
||||
// arrange
|
||||
setConfig('jwtSecret', faker.random.word());
|
||||
const data = faker.random.word();
|
||||
const salt = faker.random.word();
|
||||
setConfig('jwtSecret', faker.lorem.word());
|
||||
const data = faker.lorem.word();
|
||||
const salt = faker.lorem.word();
|
||||
|
||||
// act
|
||||
const encryptedData = encrypt(data, salt);
|
||||
@ -18,9 +18,9 @@ describe('Test: encrypt', () => {
|
||||
|
||||
it('should decrypt the provided data', () => {
|
||||
// arrange
|
||||
setConfig('jwtSecret', faker.random.word());
|
||||
const data = faker.random.word();
|
||||
const salt = faker.random.word();
|
||||
setConfig('jwtSecret', faker.lorem.word());
|
||||
const data = faker.lorem.word();
|
||||
const salt = faker.lorem.word();
|
||||
|
||||
// act
|
||||
const encryptedData = encrypt(data, salt);
|
||||
|
Loading…
Reference in New Issue
Block a user