snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-16 01:21:02 +05:00
commit 30810eecd7
10161 changed files with 987110 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import * as assert from 'node:assert';
import { describe, it } from 'node:test';
import { AppCompiler } from '../../../src/server/compiler';
describe('AppCompiler', () => {
it('verifyStorageFileToCompiler', () => {
const compiler = new AppCompiler();
assert.doesNotThrow(() => compiler.normalizeStorageFiles({}));
const files: { [key: string]: string } = {
TestingApp$ts: 'act-like-this-is-real',
TestingAppCommand$ts: 'something-here-as well, yay',
};
const expected: { [key: string]: string } = {
'TestingApp.ts': files.TestingApp$ts,
'TestingAppCommand.ts': files.TestingAppCommand$ts,
};
assert.deepStrictEqual(compiler.normalizeStorageFiles(files), expected);
});
});

View File

@@ -0,0 +1,129 @@
import * as assert from 'node:assert';
import { describe, it } from 'node:test';
import { AppStatus } from '@rocket.chat/apps-engine/definition/AppStatus';
import type { IAppInfo } from '@rocket.chat/apps-engine/definition/metadata';
import { AppInterface } from '@rocket.chat/apps-engine/definition/metadata';
import type { AppManager } from '../../../src/server/AppManager';
import { ProxiedApp } from '../../../src/server/ProxiedApp';
import { AppFabricationFulfillment } from '../../../src/server/compiler';
import { AppPermissions } from '../../../src/server/permissions/AppPermissions';
import type { IAppStorageItem } from '../../../src/server/storage';
import { TestData } from '../../test-data/utilities';
describe('AppFabricationFulfillment', () => {
it('appFabricationDefinement', () => {
const expctedInfo: IAppInfo = {
id: '614055e2-3dba-41fb-be48-c1ff146f5932',
name: 'Testing App',
nameSlug: 'testing-app',
description: 'A Rocket.Chat Application used to test out the various features.',
version: '0.0.8',
requiredApiVersion: '>=0.9.6',
author: {
name: 'Bradley Hilton',
homepage: 'https://github.com/RocketChat/Rocket.Chat.Apps-ts-definitions',
support: 'https://github.com/RocketChat/Rocket.Chat.Apps-ts-definitions/issues',
},
classFile: 'TestingApp.ts',
iconFile: 'testing.jpg',
implements: [],
permissions: [],
};
assert.doesNotThrow(() => new AppFabricationFulfillment());
const aff = new AppFabricationFulfillment();
assert.doesNotThrow(() => aff.setAppInfo(expctedInfo));
assert.deepStrictEqual(aff.getAppInfo(), expctedInfo);
const expectedInter: { [key: string]: boolean } = {};
expectedInter[AppInterface.IPreMessageSentPrevent] = true;
assert.doesNotThrow(() => aff.setImplementedInterfaces(expectedInter));
assert.deepStrictEqual(aff.getImplementedInferfaces(), expectedInter);
const fakeApp = new ProxiedApp(
{} as AppManager,
{ status: AppStatus.UNKNOWN } as IAppStorageItem,
TestData.getMockRuntimeController('unknown'),
);
assert.doesNotThrow(() => aff.setApp(fakeApp));
assert.deepStrictEqual(aff.getApp(), fakeApp);
});
it('setAppInfoCreatesDeepClone', () => {
const originalInfo: IAppInfo = {
id: 'test-app-id',
name: 'Test App',
nameSlug: 'test-app',
description: 'A test application',
version: '1.0.0',
requiredApiVersion: '>=1.0.0',
author: {
name: 'Test Author',
homepage: 'https://example.com',
support: 'https://example.com/support',
},
classFile: 'TestApp.ts',
iconFile: 'test.jpg',
implements: [AppInterface.IPreMessageSentPrevent],
permissions: [AppPermissions.user.read, AppPermissions.user.write],
};
const aff = new AppFabricationFulfillment();
aff.setAppInfo(originalInfo);
assert.deepStrictEqual(aff.getAppInfo(), originalInfo);
originalInfo.name = 'Modified Name';
originalInfo.author.name = 'Modified Author';
originalInfo.implements.push(AppInterface.IPostMessageSent);
originalInfo.permissions.push(AppPermissions.message.write);
assert.notStrictEqual(aff.getAppInfo().name, 'Modified Name');
assert.notStrictEqual(aff.getAppInfo().author.name, 'Modified Author');
assert.ok(!aff.getAppInfo().implements.includes(AppInterface.IPostMessageSent));
assert.ok(!aff.getAppInfo().permissions.includes(AppPermissions.message.write));
assert.strictEqual(aff.getAppInfo().name, 'Test App');
assert.strictEqual(aff.getAppInfo().author.name, 'Test Author');
assert.deepStrictEqual(aff.getAppInfo().implements, [AppInterface.IPreMessageSentPrevent]);
assert.deepStrictEqual(aff.getAppInfo().permissions, [AppPermissions.user.read, AppPermissions.user.write]);
});
it('setImplementedInterfacesCreatesDeepClone', () => {
const originalInterfaces: { [int: string]: boolean } = {
[AppInterface.IPreMessageSentPrevent]: true,
[AppInterface.IPostMessageSent]: false,
[AppInterface.IPreMessageSentExtend]: true,
};
const aff = new AppFabricationFulfillment();
aff.setImplementedInterfaces(originalInterfaces);
assert.deepStrictEqual(aff.getImplementedInferfaces(), originalInterfaces);
originalInterfaces[AppInterface.IPreMessageSentPrevent] = false;
originalInterfaces[AppInterface.IPostMessageSent] = true;
originalInterfaces[AppInterface.IPreMessageSentModify] = true;
assert.notStrictEqual(aff.getImplementedInferfaces()[AppInterface.IPreMessageSentPrevent], false);
assert.notStrictEqual(aff.getImplementedInferfaces()[AppInterface.IPostMessageSent], true);
assert.ok(aff.getImplementedInferfaces()[AppInterface.IPreMessageSentModify] === undefined);
assert.strictEqual(aff.getImplementedInferfaces()[AppInterface.IPreMessageSentPrevent], true);
assert.strictEqual(aff.getImplementedInferfaces()[AppInterface.IPostMessageSent], false);
assert.strictEqual(aff.getImplementedInferfaces()[AppInterface.IPreMessageSentExtend], true);
});
it('setImplementedInterfacesHandlesEmptyObject', () => {
const emptyInterfaces: { [int: string]: boolean } = {};
const aff = new AppFabricationFulfillment();
assert.doesNotThrow(() => aff.setImplementedInterfaces(emptyInterfaces));
assert.strictEqual(Object.keys(aff.getImplementedInferfaces()).length, 0);
assert.notStrictEqual(aff.getImplementedInferfaces(), emptyInterfaces);
});
});

View File

@@ -0,0 +1,21 @@
import * as assert from 'node:assert';
import { describe, it } from 'node:test';
import { AppInterface } from '@rocket.chat/apps-engine/definition/metadata';
import { AppImplements } from '../../../src/server/compiler';
describe('AppImplements', () => {
it('appImplements', () => {
assert.doesNotThrow(() => new AppImplements());
const impls = new AppImplements();
assert.ok(impls.getValues() !== undefined);
assert.doesNotThrow(() => impls.setImplements(AppInterface.IPreMessageSentPrevent));
assert.strictEqual(impls.doesImplement(AppInterface.IPreMessageSentPrevent), true);
assert.strictEqual(impls.doesImplement(AppInterface.IPostMessageDeleted), false);
assert.strictEqual(impls.getValues()[AppInterface.IPreMessageSentPrevent], true);
assert.strictEqual(impls.getValues()[AppInterface.IPostMessageDeleted], false);
});
});