From a25e4c41cba8f0bceff8de0ea14f35e82907a9f7 Mon Sep 17 00:00:00 2001
From: Lorenz van Herwaarden <lvanherwaarden@gitlab.com>
Date: Thu, 22 Aug 2024 08:22:53 +0000
Subject: [PATCH] Fix vue 3 jest spec failure for section_identifiers.vue

---
 .../new_vulnerability/section_identifiers_spec.js  | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/ee/spec/frontend/vulnerabilities/new_vulnerability/section_identifiers_spec.js b/ee/spec/frontend/vulnerabilities/new_vulnerability/section_identifiers_spec.js
index 4889dececd594..e3fb8cdf2eb9c 100644
--- a/ee/spec/frontend/vulnerabilities/new_vulnerability/section_identifiers_spec.js
+++ b/ee/spec/frontend/vulnerabilities/new_vulnerability/section_identifiers_spec.js
@@ -56,20 +56,20 @@ describe('New vulnerability - Section Identifiers', () => {
     expect(findFormGroup(1).text()).toContain(ERROR_IDENTIFIER_URL);
   });
 
-  it('emits change event when input changes', () => {
+  it('emits change event when input changes', async () => {
     const codeInput = findIdentifierCodeInput();
     const urlInput = findIdentifierUrlInput();
 
     codeInput.setValue('cve-23');
     urlInput.setValue('https://gitlab.com');
 
-    expect(wrapper.emitted('change')[0][0]).toEqual({
-      identifiers: [{ name: 'cve-23', url: '' }],
-    });
+    await nextTick();
 
-    expect(wrapper.emitted('change')[1][0]).toEqual({
-      identifiers: [{ name: 'cve-23', url: 'https://gitlab.com' }],
-    });
+    expect(wrapper.emitted('change').at(-1)).toEqual([
+      {
+        identifiers: [{ name: 'cve-23', url: 'https://gitlab.com' }],
+      },
+    ]);
   });
 
   it('adds and removes identifier rows', async () => {
-- 
GitLab