Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions modules/ui/src/app/store/effects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,35 @@ describe('Effects', () => {
done();
});
});

it('should call updateValidInterfaces and set all true if interface are empty and config is not set', done => {
actions$ = of(
actions.fetchInterfacesSuccess({
interfaces: {},
}),
actions.fetchSystemConfigSuccess({
systemConfig: {
network: {
device_intf: '',
internet_intf: '',
},
},
})
);

effects.checkInterfacesInConfig$.subscribe(action => {
expect(action).toEqual(
actions.updateValidInterfaces({
validInterfaces: {
hasSetInterfaces: true,
deviceValid: true,
internetValid: true,
},
})
);
done();
});
});
});

it('onFetchSystemStatus$ should call onFetchSystemStatusSuccess on success', done => {
Expand Down
8 changes: 5 additions & 3 deletions modules/ui/src/app/store/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ export class AppEffects {
validInterfaces: {
hasSetInterfaces: network != null,
deviceValid:
!!network &&
!!network.device_intf &&
!!interfaces[network.device_intf],
(!!network &&
!!network.device_intf &&
!!interfaces[network.device_intf]) ||
(network?.device_intf == '' &&
Object.keys(interfaces).length === 0),
internetValid:
!!network &&
(network?.internet_intf == '' ||
Expand Down