cleaning up some tests

pull/713/head
flbn 2 years ago
parent 8f524abfba
commit bac8319f3d

@ -12,7 +12,9 @@ describe('Generic Extractor Utils', () => {
<p>Ooo good one</p>
</div>
`;
assert.equal(brsToPs(cheerio.load(html)).html(), html);
let $ = cheerio.load(html);
$ = brsToPs($);
assert.equal($.html(), html);
});
it('does nothing when a single BR is present', () => {
@ -29,8 +31,9 @@ describe('Generic Extractor Utils', () => {
<p>Ooo good one</p>
</div>
`;
assertClean(brsToPs(cheerio.load(before)).html(), after);
let $ = cheerio.load(before);
$ = brsToPs($);
assertClean($.html(), after);
});
it('converts double BR tags to an empty P tag', () => {
@ -47,8 +50,9 @@ describe('Generic Extractor Utils', () => {
<p> </p><p>Ooo good one</p>
</div>
`;
assertClean(brsToPs(cheerio.load(before)).html(), after);
let $ = cheerio.load(before);
$ = brsToPs($);
assertClean($.html(), after);
});
it('converts several BR tags to an empty P tag', () => {
@ -68,8 +72,9 @@ describe('Generic Extractor Utils', () => {
<p> </p><p>Ooo good one</p>
</div>
`;
assertClean(brsToPs(cheerio.load(before)).html(), after);
let $ = cheerio.load(before);
$ = brsToPs($);
assertClean($.html(), after);
});
it('converts BR tags in a P tag into a P containing inline children', () => {
@ -89,8 +94,9 @@ describe('Generic Extractor Utils', () => {
Here is more text
</p></p>
`;
assertClean(brsToPs(cheerio.load(before)).html(), after);
let $ = cheerio.load(before);
$ = brsToPs($);
assertClean($.html(), after);
});
});
});

@ -30,8 +30,9 @@ describe('convertToParagraphs($)', () => {
</p><p>This should become a p</p>
</p> <p>This should become a p</p>
`;
assertClean(convertToParagraphs(cheerio.load(before)).html(), after);
let $ = cheerio.load(before);
$ = convertToParagraphs($);
assertClean($.html(), after);
}
});
@ -45,7 +46,8 @@ describe('convertToParagraphs($)', () => {
</div>
</div>
`;
assertClean(convertToParagraphs(cheerio.load(html)).html(), html);
let $ = cheerio.load(html);
$ = convertToParagraphs($);
assertClean($.html(), html);
});
});

@ -12,9 +12,9 @@ describe('Generic Extractor Utils', () => {
<p>Ooo good one</p>
</div>
`;
const stripped = stripUnlikelyCandidates(cheerio.load(html));
assert.equal(stripped.html(), html);
let $ = cheerio.load(html);
$ = stripUnlikelyCandidates($);
assert.equal($.html(), html);
});
it('strips unlikely matches from the doc', () => {
@ -29,8 +29,9 @@ describe('Generic Extractor Utils', () => {
<p>Ooo good one</p>
</div>
`;
assertClean(stripUnlikelyCandidates(cheerio.load(before)).html(), after);
let $ = cheerio.load(before);
$ = stripUnlikelyCandidates($);
assertClean($.html(), after);
});
it('keeps likely matches even when they also match the blacklist', () => {
@ -45,7 +46,9 @@ describe('Generic Extractor Utils', () => {
<p>Ooo good one</p>
</div>
`;
assertClean(stripUnlikelyCandidates(cheerio.load(before)).html(), after);
let $ = cheerio.load(before);
$ = stripUnlikelyCandidates($);
assertClean($.html(), after);
});
it('removed likely matches when inside blacklist node', () => {
@ -65,8 +68,9 @@ describe('Generic Extractor Utils', () => {
<div>Something unrelated</div>
</div>
`;
assertClean(stripUnlikelyCandidates(cheerio.load(before)).html(), after);
let $ = cheerio.load(before);
$ = stripUnlikelyCandidates($);
assertClean($.html(), after);
});
});
});

Loading…
Cancel
Save