refactor(app-config): remove canCustomConnect virtual attribute
This commit is contained in:
@@ -39,9 +39,3 @@ exports[`AppConfig model > jsonSchema should have correct validations 1`] = `
|
||||
"type": "object",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`AppConfig model > virtualAttributes should return correct properties 1`] = `
|
||||
[
|
||||
"canCustomConnect",
|
||||
]
|
||||
`;
|
||||
|
@@ -32,14 +32,6 @@ class AppConfig extends Base {
|
||||
},
|
||||
});
|
||||
|
||||
static get virtualAttributes() {
|
||||
return ['canCustomConnect'];
|
||||
}
|
||||
|
||||
get canCustomConnect() {
|
||||
return !this.disabled && this.allowCustomConnection;
|
||||
}
|
||||
|
||||
async getApp() {
|
||||
if (!this.key) return null;
|
||||
|
||||
|
@@ -36,14 +36,14 @@ describe('AppConfig model', () => {
|
||||
expect(AppConfig.virtualAttributes).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe('canCustomConnect', () => {
|
||||
describe('allowCustomConnection', () => {
|
||||
it('should return true when app is enabled and allows custom connection', async () => {
|
||||
const appConfig = await createAppConfig({
|
||||
disabled: false,
|
||||
allowCustomConnection: true,
|
||||
});
|
||||
|
||||
expect(appConfig.canCustomConnect).toBe(true);
|
||||
expect(appConfig.allowCustomConnection).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false when app is disabled', async () => {
|
||||
@@ -52,7 +52,7 @@ describe('AppConfig model', () => {
|
||||
allowCustomConnection: true,
|
||||
});
|
||||
|
||||
expect(appConfig.canCustomConnect).toBe(false);
|
||||
expect(appConfig.allowCustomConnection).toBe(false);
|
||||
});
|
||||
|
||||
it(`should return false when app doesn't allow custom connection`, async () => {
|
||||
@@ -61,7 +61,7 @@ describe('AppConfig model', () => {
|
||||
allowCustomConnection: false,
|
||||
});
|
||||
|
||||
expect(appConfig.canCustomConnect).toBe(false);
|
||||
expect(appConfig.allowCustomConnection).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -6,7 +6,6 @@ const appConfigSerializer = (appConfig) => {
|
||||
shared: appConfig.shared,
|
||||
disabled: appConfig.disabled,
|
||||
connectionAllowed: appConfig.connectionAllowed,
|
||||
canCustomConnect: appConfig.canCustomConnect,
|
||||
createdAt: appConfig.createdAt.getTime(),
|
||||
updatedAt: appConfig.updatedAt.getTime(),
|
||||
};
|
||||
|
@@ -17,7 +17,6 @@ describe('appConfig serializer', () => {
|
||||
shared: appConfig.shared,
|
||||
disabled: appConfig.disabled,
|
||||
connectionAllowed: appConfig.connectionAllowed,
|
||||
canCustomConnect: appConfig.canCustomConnect,
|
||||
createdAt: appConfig.createdAt.getTime(),
|
||||
updatedAt: appConfig.updatedAt.getTime(),
|
||||
};
|
||||
|
@@ -7,7 +7,6 @@ const getAppConfigMock = (appConfig) => {
|
||||
shared: appConfig.shared,
|
||||
disabled: appConfig.disabled,
|
||||
connectionAllowed: appConfig.connectionAllowed,
|
||||
canCustomConnect: appConfig.canCustomConnect,
|
||||
createdAt: appConfig.createdAt.getTime(),
|
||||
updatedAt: appConfig.updatedAt.getTime(),
|
||||
},
|
||||
|
Reference in New Issue
Block a user