Skip to content

Commit 2808035

Browse files
authored
test: ensure to test al test functions (microlinkhq#797)
1 parent b60173a commit 2808035

File tree

6 files changed

+69
-0
lines changed

6 files changed

+69
-0
lines changed

packages/metascraper-amazon/src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,5 @@ module.exports = () => {
6464

6565
return rules
6666
}
67+
68+
module.exports.test = test
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
'use strict'
2+
3+
const test = require('ava')
4+
5+
const { test: validator } = require('..')
6+
7+
test('true', t => {
8+
t.true(validator('https://www.amazon.com/gp/product/B0057OC5O8/'))
9+
t.true(validator('https://amazon.com/dp/B0123456789'))
10+
t.true(validator('https://www.amazon.co.uk/dp/1849757097'))
11+
t.true(validator('https://amazon.es/dp/B01MUGXRT9'))
12+
t.true(validator('https://www.amazon.de/dp/B0123456789'))
13+
t.true(validator('https://amazon.fr/dp/B0123456789'))
14+
t.true(validator('https://www.amazon.it/dp/B0123456789'))
15+
t.true(validator('https://amzn.to/abc123'))
16+
t.true(validator('https://a.co/abc123'))
17+
})
18+
19+
test('false', t => {
20+
t.false(
21+
validator(
22+
'https://soundcloud.com/beautybrainsp/beauty-brain-swag-bandicoot'
23+
)
24+
)
25+
t.false(validator('https://www.facebook.com/username/'))
26+
t.false(validator('https://twitter.com/username/'))
27+
t.false(validator('https://www.youtube.com/watch?v=123'))
28+
t.false(validator('https://example.com'))
29+
})

packages/metascraper-instagram/src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,5 @@ module.exports = () => {
4141

4242
return rules
4343
}
44+
45+
module.exports.test = test
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict'
2+
3+
const test = require('ava')
4+
5+
const { test: validator } = require('..')
6+
7+
test('true', t => {
8+
t.true(validator('https://www.instagram.com/p/CPeC-Eenc8l/'))
9+
})
10+
11+
test('false', t => {
12+
t.false(
13+
validator(
14+
'https://soundcloud.com/beautybrainsp/beauty-brain-swag-bandicoot'
15+
)
16+
)
17+
})

packages/metascraper-soundcloud/src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ module.exports = () => {
2828

2929
return rules
3030
}
31+
32+
module.exports.test = test
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
'use strict'
2+
3+
const test = require('ava')
4+
5+
const { test: validator } = require('..')
6+
7+
test('true', t => {
8+
t.true(
9+
validator(
10+
'https://soundcloud.com/beautybrainsp/beauty-brain-swag-bandicoot'
11+
)
12+
)
13+
})
14+
15+
test('false', t => {
16+
t.false(validator('https://www.instagram.com/p/CPeC-Eenc8l/'))
17+
})

0 commit comments

Comments
 (0)