Files
pokemon-showdown/test/server/chat-plugins/youtube.js
Guangcong Luo 78439b4a02 Update to ESLint 9 (#10926)
ESLint has a whole new config format, so I figure it's a good time to
make the config system saner.

- First, we no longer have separate eslint-no-types configs. Lint
  performance shouldn't be enough of a problem to justify the
  relevant maintenance complexity.

- Second, our base config should work out-of-the-box now. `npx eslint`
  will work as expected, without any CLI flags. You should still use
  `npm run lint` which adds the `--cached` flag for performance.

- Third, whatever updates I did fixed style linting, which apparently
  has been bugged for quite some time, considering all the obvious
  mixed-tabs-and-spaces issues I found in the upgrade.

Also here are some changes to our style rules. In particular:

- Curly brackets (for objects etc) now have spaces inside them. Sorry
  for the huge change. ESLint doesn't support our old style, and most
  projects use Prettier style, so we might as well match them in this way.
  See https://github.com/eslint-stylistic/eslint-stylistic/issues/415

- String + number concatenation is no longer allowed. We now
  consistently use template strings for this.
2025-02-25 20:03:46 -08:00

40 lines
1.5 KiB
JavaScript

/**
* Tests for the Youtube room plugin.
* Written by Mia.
* @author mia-pi-git
*/
'use strict';
const YoutubeInterface = require('../../../dist/server/chat-plugins/youtube').YoutubeInterface;
const assert = require('../../assert');
describe(`Youtube features`, () => {
it.skip(`should correctly add channels to the database`, async () => {
if (!Config.youtubeKey) return true;
const Youtube = new YoutubeInterface({});
const url = 'https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw';
await Youtube.getChannelData(url, undefined);
assert(Youtube.data['UCuAXFkgsw1L7xaCfnd5JJOw']);
});
it.skip(`should correctly handle PS names and channel names`, async () => {
if (!Config.youtubeKey) return true;
const Youtube = new YoutubeInterface({});
const url = 'https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw';
const channelId = 'UCuAXFkgsw1L7xaCfnd5JJOw';
await Youtube.getChannelData(url, 'Pickle Rick');
assert.equal(channelId, Youtube.channelSearch('Pickle Rick'));
assert.equal(channelId, Youtube.channelSearch('Official Rick Astley'));
});
it.skip(`should correctly parse channel links`, () => {
if (!Config.youtubeKey) return true;
const videoUrl = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
const channelUrl = 'https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw';
const Youtube = new YoutubeInterface({});
const videoId = Youtube.getId(videoUrl);
assert.equal(videoId, 'dQw4w9WgXcQ');
const channelId = Youtube.getId(channelUrl);
assert.equal(channelId, 'UCuAXFkgsw1L7xaCfnd5JJOw');
});
});