-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd922b2
commit 29ed2e4
Showing
35 changed files
with
246 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 5 additions & 16 deletions
21
netlify/functions/videoWrapper/Providers/Asciinema.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
import { test } from 'uvu'; | ||
import { equal } from 'uvu/assert'; | ||
|
||
import Asciinema from './Asciinema.js'; | ||
import { createTest } from './test.helpers.js'; | ||
|
||
test('"regex" must be correct.', () => { | ||
equal(Asciinema.getVideoId('https://asciinema.org/a/335480'), '335480'); | ||
}); | ||
|
||
test('all methods must work.', () => { | ||
const url = 'https://asciinema.org/a/335480'; | ||
const video = new Asciinema(url); | ||
|
||
// static methods | ||
equal(Asciinema.check(url), true); | ||
|
||
// instance methods | ||
equal(video.getId(), '335480'); | ||
equal(video.providerName, 'asciinema'); | ||
equal(video.url, url); | ||
createTest(Asciinema, 'https://asciinema.org/a/335480', { | ||
id: '335480', | ||
isValid: true, | ||
providerName: 'asciinema', | ||
}); | ||
|
||
test.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 5 additions & 16 deletions
21
netlify/functions/videoWrapper/Providers/CleanShotCloud.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
import { test } from 'uvu'; | ||
import { equal } from 'uvu/assert'; | ||
|
||
import CleanShotCloud from './CleanShotCloud.js'; | ||
import { createTest } from './test.helpers.js'; | ||
|
||
test('"regex" must be correct.', () => { | ||
equal(CleanShotCloud.getVideoId('https://cln.sh/YRePNX'), 'YRePNX'); | ||
}); | ||
|
||
test('all methods must work.', () => { | ||
const url = 'https://cln.sh/YRePNX'; | ||
const video = new CleanShotCloud(url); | ||
|
||
// static methods | ||
equal(CleanShotCloud.check(url), true); | ||
|
||
// instance methods | ||
equal(video.getId(), 'YRePNX'); | ||
equal(video.providerName, 'cleanshot-cloud'); | ||
equal(video.url, url); | ||
createTest(CleanShotCloud, 'https://cln.sh/YRePNX', { | ||
isValid: true, | ||
id: 'YRePNX', | ||
providerName: 'cleanshot-cloud', | ||
}); | ||
|
||
test.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions
28
netlify/functions/videoWrapper/Providers/Dailymotion.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import { test } from 'uvu'; | ||
import { equal } from 'uvu/assert'; | ||
|
||
import Dailymotion from './Dailymotion.js'; | ||
import { createTest } from './test.helpers.js'; | ||
|
||
test('"regex" must be correct.', () => { | ||
equal(Dailymotion.getVideoId('https://www.dailymotion.com/video/x3ke49'), 'x3ke49'); | ||
equal(Dailymotion.getVideoId('https://dai.ly/xxl8su'), 'xxl8su'); | ||
createTest(Dailymotion, 'https://www.dailymotion.com/video/x3ke49', { | ||
isValid: true, | ||
id: 'x3ke49', | ||
providerName: 'dailymotion', | ||
}); | ||
|
||
test('all methods must work.', () => { | ||
const url = 'https://www.dailymotion.com/video/x3ke49'; | ||
const video = new Dailymotion(url); | ||
|
||
// static methods | ||
equal(Dailymotion.check(url), true); | ||
createTest(Dailymotion, 'https://dai.ly/xxl8su', { | ||
isValid: true, | ||
id: 'xxl8su', | ||
providerName: 'dailymotion', | ||
}); | ||
|
||
// instance methods | ||
equal(video.getId(), 'x3ke49'); | ||
equal(video.providerName, 'dailymotion'); | ||
equal(video.url, url); | ||
createTest(Dailymotion, 'https://example.com/1234', { | ||
isValid: false, | ||
id: null, | ||
providerName: 'dailymotion', | ||
}); | ||
|
||
test.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,18 @@ | ||
import { test } from 'uvu'; | ||
import { equal } from 'uvu/assert'; | ||
|
||
import Facebook from './Facebook.js'; | ||
import { createTest } from './test.helpers.js'; | ||
|
||
test('"regex" must be correct.', () => { | ||
equal( | ||
Facebook.getVideoId('https://www.facebook.com/backintimetheparty/videos/1588846901182916/'), | ||
'1588846901182916', | ||
); | ||
equal( | ||
Facebook.getVideoId('https://www.facebook.com/backintimetheparty/videos/description/1588846901182916/'), | ||
'1588846901182916', | ||
); | ||
createTest(Facebook, 'https://www.facebook.com/backintimetheparty/videos/1588846901182916/', { | ||
isValid: true, | ||
id: '1588846901182916', | ||
providerName: 'facebook', | ||
}); | ||
|
||
test('all methods must work.', () => { | ||
const url = 'https://www.facebook.com/backintimetheparty/videos/1588846901182916/'; | ||
const video = new Facebook(url); | ||
|
||
// static methods | ||
equal(Facebook.check(url), true); | ||
|
||
// instance methods | ||
equal(video.getId(), '1588846901182916'); | ||
equal(video.providerName, 'facebook'); | ||
equal(video.url, url); | ||
createTest(Facebook, 'https://www.facebook.com/backintimetheparty/videos/description/1588846901182916/', { | ||
isValid: true, | ||
id: '1588846901182916', | ||
providerName: 'facebook', | ||
}); | ||
|
||
test.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 14 additions & 24 deletions
38
netlify/functions/videoWrapper/Providers/GoogleDrive.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,24 @@ | ||
import { test } from 'uvu'; | ||
import { equal } from 'uvu/assert'; | ||
|
||
import GoogleDrive from './GoogleDrive.js'; | ||
import { createTest } from './test.helpers.js'; | ||
|
||
test('"regex" must be correct.', () => { | ||
equal( | ||
GoogleDrive.getVideoId('https://drive.google.com/file/d/5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc/view'), | ||
'5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc', | ||
); | ||
equal( | ||
GoogleDrive.getVideoId('https://drive.google.com/open?id=5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc'), | ||
'5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc', | ||
); | ||
equal( | ||
GoogleDrive.getVideoId('https://docs.google.com/presentation/d/5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc/edit?usp=sharing'), | ||
'5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc', | ||
); | ||
createTest(GoogleDrive, 'https://drive.google.com/file/d/5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc/view', { | ||
isValid: true, | ||
id: '5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc', | ||
providerName: 'google-drive', | ||
}); | ||
|
||
test('all methods must work.', () => { | ||
const url = 'https://drive.google.com/file/d/5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc/view'; | ||
const video = new GoogleDrive(url); | ||
|
||
// static methods | ||
equal(GoogleDrive.check(url), true); | ||
createTest(GoogleDrive, 'https://drive.google.com/open?id=5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc', { | ||
isValid: true, | ||
id: '5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc', | ||
providerName: 'google-drive', | ||
}); | ||
|
||
// instance methods | ||
equal(video.getId(), '5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc'); | ||
equal(video.providerName, 'google-drive'); | ||
equal(video.url, url); | ||
createTest(GoogleDrive, 'https://docs.google.com/presentation/d/5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc/edit?usp=sharing', { | ||
isValid: true, | ||
id: '5p_qEW432qT5_EWQjwTo-Q5FaEjjsWUvc', | ||
providerName: 'google-drive', | ||
}); | ||
|
||
test.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
import { test } from 'uvu'; | ||
import { equal } from 'uvu/assert'; | ||
|
||
import Imgur from './Imgur.js'; | ||
import { createTest } from './test.helpers.js'; | ||
|
||
test('"regex" must be correct.', () => { | ||
equal(Imgur.getVideoId('https://imgur.com/VT1vCoz'), 'VT1vCoz'); | ||
}); | ||
|
||
test('all methods must work.', () => { | ||
const url = 'https://imgur.com/VT1vCoz'; | ||
const video = new Imgur(url); | ||
|
||
// static methods | ||
equal(Imgur.check(url), true); | ||
|
||
// instance methods | ||
equal(video.getId(), 'VT1vCoz'); | ||
equal(video.providerName, 'imgur'); | ||
equal(video.url, url); | ||
createTest(Imgur, 'https://imgur.com/VT1vCoz', { | ||
isValid: true, | ||
id: 'VT1vCoz', | ||
providerName: 'imgur', | ||
}); | ||
|
||
test.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,12 @@ | ||
import { test } from 'uvu'; | ||
import { equal } from 'uvu/assert'; | ||
|
||
import Loom from './Loom.js'; | ||
import { createTest } from './test.helpers.js'; | ||
|
||
test('"regex" must be correct.', () => { | ||
equal( | ||
Loom.getVideoId('https://www.loom.com/share/3d0b326f650749bbb1fa13895dcd6563'), | ||
'3d0b326f650749bbb1fa13895dcd6563', | ||
); | ||
}); | ||
|
||
test('all methods must work.', () => { | ||
const url = 'https://www.loom.com/share/3d0b326f650749bbb1fa13895dcd6563'; | ||
const video = new Loom(url); | ||
|
||
// static methods | ||
equal(Loom.check(url), true); | ||
|
||
// instance methods | ||
equal(video.getId(), '3d0b326f650749bbb1fa13895dcd6563'); | ||
equal(video.providerName, 'loom'); | ||
equal(video.url, url); | ||
createTest(Loom, 'https://www.loom.com/share/3d0b326f650749bbb1fa13895dcd6563', { | ||
isValid: true, | ||
id: '3d0b326f650749bbb1fa13895dcd6563', | ||
providerName: 'loom', | ||
}); | ||
|
||
test.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,12 @@ | ||
import { test } from 'uvu'; | ||
import { equal } from 'uvu/assert'; | ||
|
||
import OneDrive from './OneDrive.js'; | ||
import { createTest } from './test.helpers.js'; | ||
|
||
test('"regex" must be correct.', () => { | ||
equal( | ||
OneDrive.getVideoId('https://1drv.ms/v/s!An21T-lhvYKSkFpqKTb4YeZpKfzC?e=iXCxja'), | ||
'An21T-lhvYKSkFpqKTb4YeZpKfzC', | ||
); | ||
}); | ||
|
||
test('all methods must work.', () => { | ||
const url = 'https://1drv.ms/v/s!An21T-lhvYKSkFpqKTb4YeZpKfzC?e=iXCxja'; | ||
const video = new OneDrive(url); | ||
|
||
// static methods | ||
equal(OneDrive.check(url), true); | ||
|
||
// instance methods | ||
equal(video.getId(), 'An21T-lhvYKSkFpqKTb4YeZpKfzC'); | ||
equal(video.providerName, 'onedrive'); | ||
equal(video.url, url); | ||
createTest(OneDrive, 'https://1drv.ms/v/s!An21T-lhvYKSkFpqKTb4YeZpKfzC?e=iXCxja', { | ||
isValid: true, | ||
id: 'An21T-lhvYKSkFpqKTb4YeZpKfzC', | ||
providerName: 'onedrive', | ||
}); | ||
|
||
test.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,12 @@ | ||
import { test } from 'uvu'; | ||
import { equal } from 'uvu/assert'; | ||
|
||
import PeerTube from './PeerTube.js'; | ||
import { createTest } from './test.helpers.js'; | ||
|
||
test('"regex" must be correct.', () => { | ||
equal(PeerTube.getVideoId('https://framatube.org/w/kkGMgK9ZtnKfYAgnEtQxbv?start=1s'), 'kkGMgK9ZtnKfYAgnEtQxbv'); | ||
}); | ||
|
||
test('all methods must work.', () => { | ||
const url = 'https://framatube.org/w/kkGMgK9ZtnKfYAgnEtQxbv?start=1s'; | ||
const video = new PeerTube(url); | ||
|
||
// static methods | ||
equal(PeerTube.check(url), true); | ||
|
||
// instance methods | ||
equal(video.getId(), 'kkGMgK9ZtnKfYAgnEtQxbv'); | ||
equal(video.providerName, 'peertube'); | ||
equal(video.url, url); | ||
createTest(PeerTube, 'https://framatube.org/w/kkGMgK9ZtnKfYAgnEtQxbv?start=1s', { | ||
isValid: true, | ||
id: 'kkGMgK9ZtnKfYAgnEtQxbv', | ||
providerName: 'peertube', | ||
}); | ||
|
||
test.run(); |
Oops, something went wrong.