refactor: Remove redundant updateConnectionAllowedProperty
This commit is contained in:
@@ -42,14 +42,6 @@ class AppConfig extends Base {
|
||||
return await App.findOneByKey(this.key);
|
||||
}
|
||||
|
||||
async updateConnectionAllowedProperty() {
|
||||
const connectionAllowed = await this.computeConnectionAllowedProperty();
|
||||
|
||||
return await this.$query().patch({
|
||||
connectionAllowed,
|
||||
});
|
||||
}
|
||||
|
||||
async computeAndAssignConnectionAllowedProperty() {
|
||||
this.connectionAllowed = await this.computeConnectionAllowedProperty();
|
||||
}
|
||||
|
@@ -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', () => {
|
||||
it('should call computeConnectionAllowedProperty and assign the result', async () => {
|
||||
const appConfig = await createAppConfig();
|
||||
|
Reference in New Issue
Block a user