MCPcopy
hub / github.com/MALSync/MALSync / generalSingleTests

Function generalSingleTests

test/src/provider/generalSingleTests.exclude.ts:5–460  ·  view source on GitHub ↗
(Single, setGlobals, titlePrefix = '')

Source from the content-addressed store, hash-verified

3import { UrlNotSupportedError } from '../../../src/_provider/Errors';
4
5export function generalSingleTests(Single, setGlobals, titlePrefix = '') {
6 describe('Url', function() {
7 describe('Constructor', function() {
8 global.testData.urlTest.forEach(el => {
9 it(el.url, function() {
10 if (!el.error) {
11 let single;
12 expect(() => (single = new Single(el.url))).not.to.throw();
13 expect(single.getType()).equal(el.type);
14 } else {
15 expect(() => new Single(el.url))
16 .to.throw(UrlNotSupportedError);
17 }
18 });
19 });
20 });
21 });
22
23 describe('Dry', function() {
24 const singleEntry = new Single(global.testData.urlTest[0].url);
25 before(async function() {
26 this.timeout(50000);
27 await singleEntry.update();
28 });
29
30 describe('Status', function() {
31 [
32 def.status.Watching,
33 def.status.Completed,
34 def.status.Onhold,
35 def.status.Dropped,
36 def.status.PlanToWatch,
37 def.status.Rewatching,
38 def.status.Considering,
39 ].forEach(el => {
40 it(def.status[el], function() {
41 singleEntry.setStatus(el);
42 if (
43 el === def.status.Rewatching &&
44 !singleEntry.supportsRewatching()
45 ) {
46 expect(singleEntry.getStatus()).equal(def.status.Watching);
47 } else if (
48 el === def.status.Considering &&
49 !singleEntry.supportsConsidering()
50 ) {
51 expect(singleEntry.getStatus()).equal(def.status.PlanToWatch);
52 } else {
53 expect(singleEntry.getStatus()).equal(el);
54 }
55 });
56 });
57 });
58
59 describe('Score', function() {
60 [
61 def.score.NoScore,
62 def.score.R1,

Callers 1

single.test.tsFile · 0.90

Calls 8

setStreamingUrlMethod · 0.95
getStreamingUrlMethod · 0.95
getCacheKeyMethod · 0.95
syncMethod · 0.80
setGlobalsFunction · 0.50
getTitleMethod · 0.45
getMalUrlMethod · 0.45
getImageMethod · 0.45

Tested by

no test coverage detected