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-engine/tests/server/accessors/EnvironmentalVariableRead.s...

33 lines
1.1 KiB

import { AsyncTest, Expect, SetupFixture } from 'alsatian';
import { EnvironmentalVariableRead } from '../../../src/server/accessors';
import type { EnvironmentalVariableBridge } from '../../../src/server/bridges';
export class EnvironmentalVariableReadAccessorTestFixture {
private mockEnvVarBridge: EnvironmentalVariableBridge;
@SetupFixture
public setupFixture() {
this.mockEnvVarBridge = {
doGetValueByName(name: string, appId: string): Promise<string> {
return Promise.resolve('value');
},
doIsReadable(name: string, appId: string): Promise<boolean> {
return Promise.resolve(true);
},
doIsSet(name: string, appId: string): Promise<boolean> {
return Promise.resolve(false);
},
} as EnvironmentalVariableBridge;
}
@AsyncTest()
public async useEnvironmentalVariableRead() {
Expect(() => new EnvironmentalVariableRead(this.mockEnvVarBridge, 'testing')).not.toThrow();
const evr = new EnvironmentalVariableRead(this.mockEnvVarBridge, 'testing');
Expect(await evr.getValueByName('testing')).toBe('value');
Expect(await evr.isReadable('testing')).toBeTruthy();
Expect(await evr.isSet('testing2')).not.toBeTruthy();
}
}