fix(node): clarify wireless enrollment and restore active K1 after upgrade
This commit is contained in:
@@ -130,3 +130,29 @@ test('a confirmed scan with zero candidates remains a valid empty result',async(
|
||||
})};
|
||||
assert.deepEqual((await api.enroll(transport,initial,'scan')).candidates,[]);
|
||||
});
|
||||
|
||||
test('finishing enrollment requires a verified current device session and survives no stale fence',()=>{
|
||||
const connected={...initial,connected:true,discovery_generation:3,mode_revision:2,
|
||||
device_session:{device_session_id:'session-one'},command_result:{status:'succeeded'}};
|
||||
assert.equal(api.enrollmentProof(initial,'synthetic-ble'),null);
|
||||
const proof=api.enrollmentProof(connected,'synthetic-ble');
|
||||
assert.ok(proof);
|
||||
assert.equal(api.enrollmentProofCurrent(proof,connected,'synthetic-ble'),true);
|
||||
for(const patch of [{fresh:false},{available:false},{connected:false},{runtime_id:'other-runtime'},
|
||||
{discovery_generation:4},{mode_revision:3},{selected_device_id:'other-device'},
|
||||
{device_session:{device_session_id:'other-session'}},{command_result:{status:'rejected'}}]){
|
||||
assert.equal(api.enrollmentProofCurrent(proof,{...connected,...patch},'synthetic-ble'),false);
|
||||
}
|
||||
assert.equal(api.enrollmentProofCurrent(null,connected,'synthetic-ble'),false);
|
||||
assert.equal(api.enrollmentProofCurrent(proof,connected,'other-device'),false);
|
||||
});
|
||||
|
||||
test('lost BLE candidate tells the operator to rescan without blaming Ethernet or Wi-Fi credentials',()=>{
|
||||
const notice=api.enrollmentNotice({...initial,connection_attempt:{
|
||||
schema_version:'missioncore.xgrids-k1-connection-attempt/v1',attempt_id:'test',status:'failed',
|
||||
public_error_code:'network-provision-candidate-not-fresh',
|
||||
}});
|
||||
assert.match(notice,/Найдите K1 ещё раз/);
|
||||
assert.match(notice,/Настройки Wi-Fi не были отправлены/);
|
||||
assert.doesNotMatch(notice,/пароль|Ethernet/);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user