i have one component Register.vue which is responsible for registration , for this i am wrighting a test cases by using jest ,Here my doubt is How to write a test case for "Online Book Shopping" present in P-tag weather content is matched or not,please help me to write a test case and for validations please share some reference for validating HTML REGEX pattern
Register.vue
<template>
<div class="main">
<div class="container">
<img id="side-img" src="../assets/sideImg.png" alt="notFound" />
<!-- i want to test weather this content is present or not -->
<p id="side-content">Online Book Shopping</p>
<form>
<div class="fullname">
<p>FullName</p>
<!-- for this input tag correct pattern is passed or not -->
<input type="name" class="namebox" required v-model="fullName" pattern="[A-Za-z]{3,12}">
</div>
</form>
</div>
</div>
</template>
Register.spec.js
import Register from '../../src/Pages/Register.vue';
import { createLocalVue, shallowMount} from '@vue/test-utils'
describe('Register.vue', ()=>{
let wrapper;
beforeEach(() => {
const localVue = createLocalVue();
wrapper = shallowMount(Register, localVue);
});
test('setup correctly', () => {
expect(true).toBe(true)
})
it('renders a vue instance', () => {
expect(shallowMount(Register).isVueInstance()).toBe(true);
})
it('has an image', () => {
expect(wrapper.contains('#side-img')).toBe(true);
});
// i stuck here weather the content is there or not
it('has online shopping content',()=>{
except(wrapper.text()).toContain('Online Book Shopping');
})
})