Refactor events checks in tests: use `System::assert_has_event`
We should not check all events neither rely on events order.
So, this issue is just about replacing all events checks by System::assert_has_event
.
For instance, instead of:
let events = System::events();
assert_eq!(events.len(), 2);
assert_eq!(
events[0],
EventRecord {
phase: Phase::Initialization,
event: Event::Identity(pallet_identity::Event::IdtyCreated {
idty_index: 6,
owner_key: 6,
}),
topics: vec![],
}
);
assert_eq!(
events[1],
EventRecord {
phase: Phase::Initialization,
event: Event::Cert(pallet_certification::Event::NewCert {
issuer: 1,
issuer_issued_count: 5,
receiver: 6,
receiver_received_count: 1
}),
topics: vec![],
}
);
We should just write:
System::assert_has_event(Event::Identity(pallet_identity::Event::IdtyCreated {
idty_index: 6,
owner_key: 6,
}));
System::assert_has_event(Event::Cert(pallet_certification::Event::NewCert {
issuer: 1,
issuer_issued_count: 5,
receiver: 6,
receiver_received_count: 1
}));
Edited by Éloïs