-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
32 lines (29 loc) · 909 Bytes
/
test.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
import test from 'ava'
const ghToPages = require('./')
const { findUsernameAndRepo } = ghToPages
test.beforeEach(t => {
t.context.ghURL = [
'https://github.com/rohmanhm/gh-to-pages',
'http://github.com/rohmanhm/gh-to-pages',
'github.com/rohmanhm/gh-to-pages',
'[email protected]:rohmanhm/gh-to-pages.git'
]
})
test('findUsernameAndRepo should return correct username and repo', t => {
t.context.ghURL.map(item => {
const ur = findUsernameAndRepo(item)
t.truthy(findUsernameAndRepo)
t.is(typeof findUsernameAndRepo, 'function')
t.is(typeof ur, 'object')
t.is(ur.username, 'rohmanhm')
t.is(ur.repo, 'gh-to-pages')
})
})
test('should return correct gh-pages', t => {
t.context.ghURL.map(item => {
const actual = ghToPages(item)
t.truthy(ghToPages)
t.is(typeof ghToPages, 'function')
t.is(actual, 'https://rohmanhm.github.io/gh-to-pages')
})
})