I have a function where I set my document title & description & and I need write a test.
func.js
const setMetaTags = function() {
document.title = "brandName";
const description = document.querySelector('meta[name="description"]');
if (description) {
description.setAttribute('content', 'text text text text');
}
};
test.js
import sum from './func.js';
describe('testFunc', () => {
it('should test something', () => {
const spyFunc = setMetaTags();
Object.defineProperty(global.document, 'meta[name="description"]', { value: ?? });
});
});
???