Add test for vin-lookup

This commit is contained in:
Chloe Herd 2023-03-14 14:40:53 -04:00
parent b5749eb8aa
commit 6b62095cf5
2 changed files with 15 additions and 1 deletions

View file

@ -242,6 +242,19 @@ describe("vin-lookup.vue", () => {
// Assert
expect(wrapper.findAllComponents({ name: "alert" }).length).toBe(0);
});
test.only("Error emitted by textbox-question element => VinScanFailed alert shown.", async () => {
// Arrange
const { wrapper } = setupMocks({});
// Act
const vinLookup = wrapper.findComponent('[data-test="vin-lookup-component"]');
vinLookup.trigger('imageLookupError');
await wrapper.vm.$nextTick();
// Assert
expect(wrapper.findAllComponents({ name: "alert" }).length).toBe(1);
});
});
});

View file

@ -30,7 +30,8 @@
maxLength="17"
includeCameraIcon
:mask="vinMask"
@image-lookup-error="displayVinScanAlert" />
@image-lookup-error="displayVinScanAlert"
data-test="vin-lookup-field" />
</div>
</div>
<div class="row mb-2">