refactor: Remove redundant updateConnectionAllowedProperty

This commit is contained in:
Faruk AYDIN
2024-10-24 17:00:47 +02:00
parent f73ffc8711
commit d66be231b3
2 changed files with 0 additions and 33 deletions

View File

@@ -42,14 +42,6 @@ class AppConfig extends Base {
return await App.findOneByKey(this.key); return await App.findOneByKey(this.key);
} }
async updateConnectionAllowedProperty() {
const connectionAllowed = await this.computeConnectionAllowedProperty();
return await this.$query().patch({
connectionAllowed,
});
}
async computeAndAssignConnectionAllowedProperty() { async computeAndAssignConnectionAllowedProperty() {
this.connectionAllowed = await this.computeConnectionAllowedProperty(); this.connectionAllowed = await this.computeConnectionAllowedProperty();
} }

View File

@@ -56,31 +56,6 @@ describe('AppConfig model', () => {
}); });
}); });
describe('updateConnectionAllowedProperty', () => {
it('should call computeConnectionAllowedProperty and patch the result', async () => {
const appConfig = await createAppConfig();
const computeConnectionAllowedPropertySpy = vi
.spyOn(appConfig, 'computeConnectionAllowedProperty')
.mockResolvedValue(true);
const patchSpy = vi
.fn()
.mockImplementation((newAppConfig) => newAppConfig);
vi.spyOn(appConfig, '$query').mockImplementation(() => ({
patch: patchSpy,
}));
await appConfig.updateConnectionAllowedProperty();
expect(computeConnectionAllowedPropertySpy).toHaveBeenCalled();
expect(patchSpy).toHaveBeenCalledWith({
connectionAllowed: true,
});
});
});
describe('computeAndAssignConnectionAllowedProperty', () => { describe('computeAndAssignConnectionAllowedProperty', () => {
it('should call computeConnectionAllowedProperty and assign the result', async () => { it('should call computeConnectionAllowedProperty and assign the result', async () => {
const appConfig = await createAppConfig(); const appConfig = await createAppConfig();