The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/apps/tests/server/managers/AppSlashCommand.test.ts

27 lines
1.1 KiB

import * as assert from 'node:assert';
import { describe, it } from 'node:test';
import type { ISlashCommand } from '@rocket.chat/apps-engine/definition/slashcommands';
import type { AppManager } from '../../../src/server/AppManager';
import { AppSlashCommand } from '../../../src/server/managers/AppSlashCommand';
import type { IAppStorageItem } from '../../../src/server/storage';
import { TestData } from '../../test-data/utilities';
describe('AppSlashCommand', () => {
it('ensureAppSlashCommand', () => {
const mockApp = TestData.getMockApp({ info: { id: 'test', name: 'TestApp' } } as IAppStorageItem, {} as AppManager);
assert.doesNotThrow(() => new AppSlashCommand(mockApp, {} as ISlashCommand));
const ascr = new AppSlashCommand(mockApp, {} as ISlashCommand);
assert.strictEqual(ascr.isRegistered, false);
assert.strictEqual(ascr.isEnabled, false);
assert.strictEqual(ascr.isDisabled, false);
ascr.hasBeenRegistered();
assert.strictEqual(ascr.isDisabled, false);
assert.strictEqual(ascr.isEnabled, true);
assert.strictEqual(ascr.isRegistered, true);
});
});