У меня есть функция, в которой я задаю заголовок и описание документа, и мне нужно написать тест.
весело c. js
const setMetaTags = function() {
document.title = "brandName";
const description = document.querySelector('meta[name="description"]');
if (description) {
description.setAttribute('content', 'text text text text');
}
};
тест. js
import sum from './func.js';
describe('testFunc', () => {
it('should test something', () => {
const spyFunc = setMetaTags();
Object.defineProperty(global.document, 'meta[name="description"]', { value: ?? });
});
});
???