diff --git a/src/scrapers/scrapers.js b/src/scrapers/scrapers.js index 798aa0fb..63b991f3 100755 --- a/src/scrapers/scrapers.js +++ b/src/scrapers/scrapers.js @@ -137,7 +137,7 @@ const scrapers = { julesjordan, karups, kellymadison, - '5kvids': kellymadison, + '8kmembers': kellymadison, killergram, kink, // kinkvr: badoink, @@ -219,7 +219,6 @@ const scrapers = { bamvisions, bang, bangbros: aylo, - bellesa, bjraw: radical, blacked: vixen, blackedraw: vixen, @@ -272,7 +271,7 @@ const scrapers = { julesjordan, karups, kellymadison, - '5kvids': kellymadison, + '8kmembers': kellymadison, killergram, kink, kinkmen: kink, diff --git a/tests/.eslintrc b/tests/.eslintrc new file mode 100755 index 00000000..e4db6f58 --- /dev/null +++ b/tests/.eslintrc @@ -0,0 +1,21 @@ +{ + "extends": "airbnb-base", + "parserOptions": { + "parser": "@babel/eslint-parser", + "sourceType": "script" + }, + "rules": { + "strict": 0, + "indent": "off", + "no-tabs": "off", + "no-unused-vars": ["error", {"argsIgnorePattern": "^_"}], + "no-console": 0, + "max-len": 0, + "no-underscore-dangle": 0, + "default-param-last": 0, + "prefer-destructuring": "off", + "arrow-body-style": 0, + "template-curly-spacing": "off", + "object-curly-newline": "off" + } +} diff --git a/tests/profiles.js b/tests/profiles.js new file mode 100644 index 00000000..d4370bd1 --- /dev/null +++ b/tests/profiles.js @@ -0,0 +1,47 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); + +const argv = require('../src/argv'); +const scrapers = require('../src/scrapers/scrapers'); +const { fetchEntitiesBySlug } = require('../src/entities'); + +const actorScrapers = scrapers.actors; + +// profiler in this context is shorthand for profile scraper +async function init() { + const entitiesBySlug = await fetchEntitiesBySlug(Object.keys(actorScrapers), { types: ['channel', 'network', 'info'], prefer: argv.prefer }); + + Object.entries(actorScrapers).reduce(async (chain, [entitySlug, scraper]) => { + await chain; + + const entity = entitiesBySlug[entitySlug] || null; + + const profilers = Array.from(new Set(Object.entries(scraper) // some layouts will use the same profiler + .flatMap(([fnKey, fnOrLayout]) => { + if (fnOrLayout.fetchProfile) { + // layout + return fnOrLayout.fetchProfile; + } + + if (fnKey === 'fetchProfile') { + // primary + return fnOrLayout; + } + + return null; + }).filter(Boolean))); + + await test(`${entitySlug} (${entity?.name})`, async () => { + await test('has entity', () => assert.notEqual(entity, null)); + await test('has profilers', () => assert.ok(profilers.length > 0)); + + await test('foo', () => { + assert.strictEqual(5, 5); + }); + }); + }, Promise.resolve()); +} + +init();