-
Notifications
You must be signed in to change notification settings - Fork 1
/
dummyMatch.js
71 lines (66 loc) · 1.63 KB
/
dummyMatch.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
'use strict';
function dummyMatcher(name, validOptions, matchFn) {
return {
name: name,
title: name,
options: [
{
name: 'test1',
title: 'Test1',
placeholder: 'test1...'
},
{
name: 'test2',
title: 'Test2',
placeholder: 'test2...'
}
],
validOptions: () => validOptions,
match: () => matchFn()
};
}
const dummySuccessMatcher = dummyMatcher('dummySuccess', true, () => Promise.resolve([
{
title: 'Roman Flügel - Wilkie',
links: [
{
title: 'Spotify',
href: 'spotify:track:5LaFLRPrb7yhc3x46Ktn6B'
}
]
}
]));
const dummySuccessMatcher2 = dummyMatcher('dummySuccess2', true, () => Promise.resolve([
{
title: 'Roman Flügel - Wilkie (remix)',
links: [
{
title: 'Spotify2',
href: 'spotify:track:5LaFLRPrb7yhc3x46Ktn6B'
}
]
}
]));
const dummySuccessMatcher3 = dummyMatcher('dummySuccess3', true, () => Promise.resolve([
{
title: 'Roman Flügel - Wilkie',
links: [
{
title: 'Spotify3',
href: 'spotify:track:5LaFLRPrb7yhc3x46Ktn6B'
}
]
},
{
title: 'Roman Flügel - Wilkie (original)',
links: [
{
title: 'Spotify3',
href: 'spotify:track:5LaFLRPrb7yhc3x46Ktn6B'
}
]
}
]));
const dummySuccessEmptyMatcher = dummyMatcher('dummySuccessEmpty', true, () => Promise.resolve({matches: []}));
const dummyOptionsErrorMatcher = dummyMatcher('optionsErrorMatcher', false, () => Promise.reject('options'));
const dummyRandomErrorMatcher = dummyMatcher('randomErrorMatcher', true, () => Promise.reject('random'));