Unify K1 discovery ownership and verification across enrollment paths
This commit is contained in:
@@ -204,3 +204,31 @@ test('pending enrollment is presented by its action button without a second noti
|
||||
}}),'');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
test('discovery errors preserve their cause and never imply a Wi-Fi refusal',()=>{
|
||||
for(const [code,text,requiresScan] of [
|
||||
['ble-discovery-busy',/поиск уже выполняется/i,false],
|
||||
['ble-adapter-unavailable',/Bluetooth недоступен/,false],
|
||||
['ble-discovery-failed',/Служба Bluetooth/,false],
|
||||
['ble-selected-device-unavailable',/Выбранный K1 не найден/,true],
|
||||
]){
|
||||
const state={...initial,connection_attempt:{schema_version:'missioncore.xgrids-k1-connection-attempt/v1',
|
||||
attempt_id:'test',status:'failed',stage:'resolution-failed',phase:'network_not_applied',
|
||||
public_error_code:code,side_effect_status:'none'}};
|
||||
assert.match(api.enrollmentNotice(state),text);
|
||||
assert.match(api.enrollmentNotice(state),/Настройки Wi-Fi не были отправлены/);
|
||||
assert.doesNotMatch(api.enrollmentNotice(state),/Проверьте.*пароль/);
|
||||
assert.equal(api.enrollmentBluetoothFailure(state),requiresScan);
|
||||
state.connection_attempt.side_effect_status='unknown';
|
||||
state.connection_attempt.phase='network_outcome_unknown';
|
||||
assert.doesNotMatch(api.enrollmentNotice(state),/не были отправлены/);
|
||||
}
|
||||
});
|
||||
|
||||
test('legacy resolution failure invalidates the form before a second stale submission',()=>{
|
||||
const state={...initial,connection_attempt:{schema_version:'missioncore.xgrids-k1-connection-attempt/v1',
|
||||
attempt_id:'test',status:'failed',stage:'resolution-failed',public_error_code:'BleakDBusError',side_effect_status:'none'}};
|
||||
assert.equal(api.enrollmentBluetoothFailure(state),true);
|
||||
assert.match(api.enrollmentNotice(state),/Найдите K1 ещё раз/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user