Minor cleanups to handleVerificationRequest in cypress tests (#10941)

* Remove redundant `verifier.done()` call

This `done` call completes the verification process and stops it responding
with further messages. It is unnecessary, *provided* the verification completes
successfully, for which see
https://github.com/matrix-org/matrix-js-sdk/pull/3382.

* Remove duplicated code in `decryption-failure` test

* remove unused imports
This commit is contained in:
Richard van der Hoff
2023-05-18 15:12:41 +00:00
committed by GitHub
parent 7d0c68aa29
commit 8654a24405
2 changed files with 9 additions and 26 deletions
+3 -5
View File
@@ -38,21 +38,19 @@ export function waitForVerificationRequest(cli: MatrixClient): Promise<Verificat
}
/**
* Handle an incoming verification request
* Automatically handle an incoming verification request
*
* Starts the key verification process, and, once it is accepted on the other side, confirms that the
* emojis match.
*
* Returns a promise that resolves, with the emoji list, once we confirm the emojis
*
* @param request - incoming verification request
* @returns A promise that resolves, with the emoji list, once we confirm the emojis
*/
export function handleVerificationRequest(request: VerificationRequest) {
export function handleVerificationRequest(request: VerificationRequest): Promise<EmojiMapping[]> {
return new Promise<EmojiMapping[]>((resolve) => {
const onShowSas = (event: ISasEvent) => {
verifier.off("show_sas", onShowSas);
event.confirm();
verifier.done();
resolve(event.sas.emoji);
};