-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
85 lines (73 loc) · 2.36 KB
/
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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*!
* gitclone <https://github.com/tunnckoCore/gitclone>
*
* Copyright (c) 2014-2016 Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)
* Released under the MIT license.
*/
/* jshint asi:true */
'use strict'
var test = require('mukla')
var gitclone = require('./index')
test('should throw if first argument object and no `owner` prop', function (done) {
function fixture () {
gitclone({ bar: 'foo' }, function noop () {})
}
test.throws(fixture, TypeError)
test.throws(fixture, /expects `owner` to be a string/)
done()
})
/**
* Uncomment and run the tests from CLI
* or from Sublime's Build System
*
* Everything works, but can't test it easily,
* because there appear prompts for github username
* and github password
*
* PRs welcome for fix this thing.
*/
// var fs = require('fs')
// var rimraf = require('rimraf')
// test('should clone different than master branch', function (done) {
// rimraf.sync('./verb')
// gitclone('verbose/verb#dev', function (err) {
// test.strictEqual(err, null)
// fs.readFile('./verb/package.json', 'utf8', function (err, res) {
// if (err) return done(err)
// var json = JSON.parse(res)
// test.strictEqual(json.version, '0.9.0')
// test.strictEqual(typeof json.repository, 'string')
// rimraf.sync('./verb')
// done()
// })
// })
// })
// test('should get master branch by default', function (done) {
// rimraf.sync('./mukla')
// gitclone('tunnckoCore/mukla', function (err, res) {
// test.strictEqual(err, null)
// rimraf.sync('./mukla')
// done()
// })
// })
// test('should handle error if `git clone` fails', function (done) {
// gitclone('some-not-foo/barqux-set-not-exist', function (err) {
// test.ok(err)
// test.strictEqual(err.name, 'SpawnError')
// test.strictEqual(err.code, 128)
// done()
// })
// })
// test('should return a spawn stream if no callback', function (done) {
// var cp = gitclone('fsdfsdfsdsffdssdfdfdfdsdsfdb', 'sdfsdf')
// test.strictEqual(typeof cp, 'object')
// test.strictEqual(typeof cp.stdout, 'object')
// test.strictEqual(typeof cp.stderr, 'object')
// done()
// })
// test('should return undefined if callback passed', function (done) {
// rimraf.sync('./sdfs')
// var res = gitclone('fsdfsdffoo/sdfs#baz', function noop () {})
// test.strictEqual(res, undefined)
// done()
// })