Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

Update tests

Ondra Urban894530950bb9
diff --git a/test/crawlers/basic_crawler.test.js b/test/crawlers/basic_crawler.test.js
index 2e3fc1728..ea9b426bf 100644
--- a/test/crawlers/basic_crawler.test.js
+++ b/test/crawlers/basic_crawler.test.js
@@ -21,7 +21,6 @@ describe('BasicCrawler', () => {
});
test('should run in parallel thru all the requests', async () => {
- const startedAt = Date.now();
const sources = _.range(0, 500).map(index => ({ url: `https://example.com/${index}` }));
const processed = [];
@@ -42,8 +41,6 @@ describe('BasicCrawler', () => {
await basicCrawler.run();
expect(processed).toEqual(sources);
- expect(Date.now() - startedAt).toBeGreaterThanOrEqual(200);
- expect(Date.now() - startedAt).toBeLessThanOrEqual(1000);
expect(await requestList.isFinished()).toBe(true);
expect(await requestList.isEmpty()).toBe(true);
});
diff --git a/test/utils_social.test.js b/test/utils_social.test.js
index a1508935f..841043b06 100644
--- a/test/utils_social.test.js
+++ b/test/utils_social.test.js
@@ -751,14 +751,14 @@ describe('utils.social', () => {
});
describe('YOUTUBE_REGEX', () => {
it('works', () => {
- expect(_.isRegExp(social.YOUTUBE_REGEX)).to.eql(true);
- expect(_.isRegExp(social.YOUTUBE_REGEX_GLOBAL)).to.eql(true);
+ expect(_.isRegExp(social.YOUTUBE_REGEX)).toBe(true);
+ expect(_.isRegExp(social.YOUTUBE_REGEX_GLOBAL)).toBe(true);
- expect(social.YOUTUBE_REGEX.flags).to.eql('i');
- expect(social.YOUTUBE_REGEX_GLOBAL.flags).to.eql('gi');
+ expect(social.YOUTUBE_REGEX.flags).toBe('i');
+ expect(social.YOUTUBE_REGEX_GLOBAL.flags).toBe('gi');
- expect(social.YOUTUBE_REGEX.test('https://www.youtube.com/watch?v=kM7YfhfkiEE')).to.eql(true);
- expect(social.YOUTUBE_REGEX.test('https://youtu.be/kM7YfhfkiEE')).to.eql(true);
+ expect(social.YOUTUBE_REGEX.test('https://www.youtube.com/watch?v=kM7YfhfkiEE')).toBe(true);
+ expect(social.YOUTUBE_REGEX.test('https://youtu.be/kM7YfhfkiEE')).toBe(true);
expect(`
-https://www.youtube.com/someusername/
youtube.com/jack4567
@@ -767,7 +767,7 @@ describe('utils.social', () => {
ayoutube.com/bob
_youtube.com/bob
`.match(social.YOUTUBE_REGEX_GLOBAL))
- .to.eql([
+ .toEqual([
'https://www.youtube.com/watch?v=kM7YfhfkiEE',
]);
});