Skip to content

Commit 58c83b9

Browse files
committed
test: cover blank signer search reset
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent f855a2f commit 58c83b9

1 file changed

Lines changed: 12 additions & 17 deletions

File tree

src/tests/components/Request/SignerSelect.spec.ts

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,6 @@ describe('SignerSelect.vue', () => {
8181
expect(result[2].iconName).toBeUndefined()
8282
})
8383

84-
it('normalizeSignerOption keeps signer payload on the OpenAPI shape', () => {
85-
const wrapper = createWrapper()
86-
const result = wrapper.vm.normalizeSignerOption({
87-
identify: 'user@example.com',
88-
isNoUser: true,
89-
shareType: 4,
90-
displayName: 'User Email',
91-
subname: 'user@example.com',
92-
})
93-
94-
expect(wrapper.vm.getOptionKey(result)).toBe('user@example.com')
95-
expect(result.displayName).toBe('User Email')
96-
expect(result.subname).toBe('user@example.com')
97-
expect(result.shareType).toBe(4)
98-
expect(result.iconName).toBeUndefined()
99-
})
100-
10184
it('onSelectedSignerChange emits a plain OpenAPI signer object', () => {
10285
const wrapper = createWrapper({ method: 'email' })
10386
const selected = wrapper.vm.injectIcons([
@@ -167,6 +150,18 @@ describe('SignerSelect.vue', () => {
167150
expect(wrapper.vm.options[0].displayName).toBe('Carol')
168151
})
169152

153+
it('clears stale results immediately when search is blank', async () => {
154+
const wrapper = createWrapper({ method: 'account' })
155+
wrapper.vm.options = [{ identify: 'legacy@example.com', isNoUser: true, shareType: 4, displayName: 'Legacy', subname: 'legacy@example.com' }]
156+
wrapper.vm.loading = true
157+
158+
await wrapper.vm._asyncFind(' ')
159+
160+
expect(axiosGetMock).not.toHaveBeenCalled()
161+
expect(wrapper.vm.options).toEqual([])
162+
expect(wrapper.vm.loading).toBe(false)
163+
})
164+
170165
it('ignores stale async response when a newer search was triggered', async () => {
171166
const wrapper = createWrapper({ method: 'account' })
172167
let resolveFirst: ((value: any) => void) | undefined

0 commit comments

Comments
 (0)