1
1
'use strict' ;
2
2
3
- require ( 'mocha' ) ;
4
- var assert = require ( 'assert' ) ;
5
- var gh = require ( './' ) ;
3
+ var test = require ( 'tape' ) ;
6
4
7
- describe ( 'parse-github-url' , function ( ) {
8
- it ( 'should get the user:' , function ( ) {
5
+ var gh = require ( '../' ) ;
6
+
7
+ test ( 'parse-github-url' , function ( t ) {
8
+ t . test ( 'gets the user:' , function ( assert ) {
9
9
assert . equal ( gh ( '' ) , null ) ;
10
10
assert . equal ( gh ( 'https://github.com/jonschlinkert/micromatch' ) . owner , 'jonschlinkert' ) ;
11
11
assert . equal ( gh ( '[email protected] :assemble/verb.git' ) . owner , 'assemble' ) ;
@@ -51,9 +51,11 @@ describe('parse-github-url', function() {
51
51
assert . equal ( gh ( ) , null ) ;
52
52
assert . equal ( gh ( null ) , null ) ;
53
53
assert . equal ( gh ( undefined ) , null ) ;
54
+
55
+ assert . end ( ) ;
54
56
} ) ;
55
57
56
- it ( 'should get the branch:', function ( ) {
58
+ t . test ( 'gets the branch:', function ( assert ) {
57
59
assert . equal ( gh ( 'assemble/verb#branch' ) . branch , 'branch' ) ;
58
60
assert . equal ( gh ( 'assemble/verb#dev' ) . branch , 'dev' ) ;
59
61
assert . equal ( gh ( '[email protected] :assemble/verb.git#0.6.0' ) . branch , '0.6.0' ) ;
@@ -67,9 +69,11 @@ describe('parse-github-url', function() {
67
69
assert . equal ( gh ( 'https://raw.githubusercontent.com/assemble/verb/4d0ebde055557a0d1d988c01e0f070df8cc8fa07/README.md' ) . branch , '4d0ebde055557a0d1d988c01e0f070df8cc8fa07' ) ;
68
70
assert . equal ( gh ( 'https://raw.githubusercontent.com/assemble/verb/dev/README.md' ) . branch , 'dev' ) ;
69
71
assert . equal ( gh ( 'https://github.com/contentful/extensions/blob/master/samples/content-tree/extension.json' ) . branch , 'master' ) ;
72
+
73
+ assert . end ( ) ;
70
74
} ) ;
71
75
72
- it ( 'should get the filepath:', function ( ) {
76
+ t . test ( 'gets the filepath:', function ( assert ) {
73
77
assert . equal ( gh ( 'assemble/verb#branch' ) . filepath , null ) ;
74
78
assert . equal ( gh ( '[email protected] :assemble/verb.git#0.6.0' ) . filepath , null ) ;
75
79
assert . equal ( gh ( 'https://github.com/assemble/verb/blob/foo/README.md' ) . filepath , 'README.md' ) ;
@@ -87,9 +91,11 @@ describe('parse-github-url', function() {
87
91
assert . equal ( gh ( 'https://raw.githubusercontent.com/tree/project/dev/README.md' ) . filepath , 'README.md' ) ;
88
92
assert . equal ( gh ( 'https://raw.githubusercontent.com/owner/blob/dev/README.md' ) . filepath , 'README.md' ) ;
89
93
assert . equal ( gh ( 'https://raw.githubusercontent.com/blob/project/dev/README.md' ) . filepath , 'README.md' ) ;
94
+
95
+ assert . end ( ) ;
90
96
} ) ;
91
97
92
- it ( 'should use master branch when another branch is not defined:', function ( ) {
98
+ t . test ( 'uses master branch when another branch is not defined:', function ( assert ) {
93
99
assert . equal ( gh ( 'assemble/verb' ) . branch , 'master' ) ;
94
100
assert . equal ( gh ( 'git://github.com/foo/bar.git' ) . branch , 'master' ) ;
95
101
assert . equal ( gh ( '[email protected] :assemble/verb.git' ) . branch , 'master' ) ;
@@ -99,9 +105,11 @@ describe('parse-github-url', function() {
99
105
assert . equal ( gh ( 'https://github.com/assemble/verb' ) . branch , 'master' ) ;
100
106
assert . equal ( gh ( 'https://raw.githubusercontent.com/assemble/verb' ) . branch , 'master' ) ;
101
107
assert . equal ( gh ( 'https://github.com/assemble/verb/blob/master/foo/index.js' ) . branch , 'master' ) ;
108
+
109
+ assert . end ( ) ;
102
110
} ) ;
103
111
104
- it ( 'should get a full repo path:', function ( ) {
112
+ t . test ( 'gets a full repo path:', function ( assert ) {
105
113
assert . equal ( gh ( 'assemble/verb#dev' ) . repo , 'assemble/verb' ) ;
106
114
assert . equal ( gh ( 'assemble/verb' ) . repo , 'assemble/verb' ) ;
107
115
assert . equal ( gh ( 'git+https://github.com/assemble/verb.git' ) . repo , 'assemble/verb' ) ;
@@ -110,9 +118,11 @@ describe('parse-github-url', function() {
110
118
assert . equal ( gh ( 'git://github.com/assemble/verb.git' ) . repo , 'assemble/verb' ) ;
111
119
assert . equal ( gh ( 'git://github.one.com/assemble/verb.git' ) . repo , 'assemble/verb' ) ;
112
120
assert . equal ( gh ( 'git://github.one.two.com/assemble/verb.git' ) . repo , 'assemble/verb' ) ;
121
+
122
+ assert . end ( ) ;
113
123
} ) ;
114
124
115
- it ( 'should know when repo is not defined:', function ( ) {
125
+ t . test ( 'knows when repo is not defined:', function ( assert ) {
116
126
assert . equal ( gh ( 'git+https://github.com/assemble' ) . name , null ) ;
117
127
assert . equal ( gh ( 'git+https://github.com/assemble' ) . repo , null ) ;
118
128
assert . equal ( gh ( 'git+https://github.com/assemble' ) . owner , 'assemble' ) ;
@@ -136,9 +146,11 @@ describe('parse-github-url', function() {
136
146
assert . equal ( gh ( 'https://github.com' ) . repo , null ) ;
137
147
assert . equal ( gh ( 'http://github.com/assemble' ) . owner , 'assemble' ) ;
138
148
assert . equal ( gh ( 'https://github.com' ) . owner , null ) ;
149
+
150
+ assert . end ( ) ;
139
151
} ) ;
140
152
141
- it ( 'should get the repo:', function ( ) {
153
+ t . test ( 'gets the repo:', function ( assert ) {
142
154
assert . equal ( gh ( 'assemble/verb#branch' ) . name , 'verb' ) ;
143
155
assert . equal ( gh ( 'assemble/dot.repo#branch' ) . name , 'dot.repo' ) ;
144
156
assert . equal ( gh ( 'assemble/verb#dev' ) . name , 'verb' ) ;
@@ -202,9 +214,11 @@ describe('parse-github-url', function() {
202
214
assert . equal ( gh ( 'https://github.com/repos/assemble/verb/zipball' ) . name , 'verb' ) ;
203
215
assert . equal ( gh ( 'https://github.com/repos/assemble/dot.repo/zipball' ) . name , 'dot.repo' ) ;
204
216
assert . equal ( gh ( 'SocialGouv/.kontinuous' ) . name , '.kontinuous' ) ;
217
+
218
+ assert . end ( ) ;
205
219
} ) ;
206
220
207
- it ( 'should get the host:', function ( ) {
221
+ t . test ( 'gets the host:', function ( assert ) {
208
222
assert . equal ( gh ( 'git+https://github.com/assemble/verb.git' ) . host , 'github.com' ) ;
209
223
assert . equal ( gh ( 'git+ssh://github.com/assemble/verb.git' ) . host , 'github.com' ) ;
210
224
assert . equal ( gh ( 'git://github.com/assemble/verb' ) . host , 'github.com' ) ;
@@ -218,9 +232,13 @@ describe('parse-github-url', function() {
218
232
assert . equal ( gh ( '[email protected] :assemble/dot.repo.git' ) . host , 'gh.pages.com' ) ;
219
233
assert . equal ( gh ( '[email protected] :atlassian/atlaskit.git' ) . host , 'bitbucket.org' ) ;
220
234
assert . equal ( gh ( '[email protected] :gitlab-org/gitlab-ce.git' ) . host , 'gitlab.com' ) ;
235
+
236
+ assert . end ( ) ;
221
237
} ) ;
222
238
223
- it ( 'should assume github.com is the host when not provided:', function ( ) {
239
+ t . test ( 'assumes github.com is the host when not provided:', function ( assert ) {
224
240
assert . equal ( gh ( 'assemble/verb' ) . host , 'github.com' ) ;
241
+
242
+ assert . end ( ) ;
225
243
} ) ;
226
244
} ) ;
0 commit comments