From 9d32da47671113beb8e262826dfe75ffcc9c00b4 Mon Sep 17 00:00:00 2001 From: cusher <30704914+cusher@users.noreply.github.com> Date: Tue, 28 Nov 2023 12:38:53 -1000 Subject: [PATCH] test(material/autocomplete): provide context for expected selections --- src/material/autocomplete/autocomplete.spec.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/material/autocomplete/autocomplete.spec.ts b/src/material/autocomplete/autocomplete.spec.ts index 9af606b215dd..ab7006cddf93 100644 --- a/src/material/autocomplete/autocomplete.spec.ts +++ b/src/material/autocomplete/autocomplete.spec.ts @@ -2573,7 +2573,9 @@ describe('MDC-based MatAutocomplete', () => { expect(input.value).toBe('Oregon'); expect(stateCtrl.value).toEqual({code: 'OR', name: 'Oregon'}); - expect(spy).toHaveBeenCalledTimes(2); + expect(spy) + .withContext(`Expected optionSelections to emit deselect previous and select new options.`) + .toHaveBeenCalledTimes(2); subscription.unsubscribe(); })); @@ -2605,7 +2607,9 @@ describe('MDC-based MatAutocomplete', () => { expect(input.value).toBe('Oregon'); expect(stateCtrl.value).toEqual({code: 'OR', name: 'Oregon'}); - expect(spy).toHaveBeenCalledTimes(2); + expect(spy) + .withContext(`Expected optionSelections to emit deselect previous and select new options.`) + .toHaveBeenCalledTimes(2); subscription.unsubscribe(); })); @@ -2672,7 +2676,9 @@ describe('MDC-based MatAutocomplete', () => { expect(input.value).toBe(''); expect(stateCtrl.value).toBe(null); - expect(spy).toHaveBeenCalledTimes(1); + expect(spy) + .withContext(`Expected optionSelections to emit deselected option.`) + .toHaveBeenCalledTimes(1); subscription.unsubscribe(); }));