FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit.nodegit/test/tests/refs.js at master · javascript-forks/nodegit.nodegit · GitHub
javascript-forks
nodegit.nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit.nodegit
/
test
/
tests
/
refs.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (45 loc) · 1.56 KB
Breadcrumbs
nodegit.nodegit
/
test
/
tests
/
refs.js
Copy path
File metadata and controls
55 lines (45 loc) · 1.56 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
var
assert
=
require
(
"assert"
)
;
var
path
=
require
(
"path"
)
;
var
promisify
=
require
(
"promisify-node"
)
;
var
local
=
path
.
join
.
bind
(
path
,
__dirname
)
;
// Have to wrap exec, since it has a weird callback signature.
var
exec
=
promisify
(
function
(
command
,
opts
,
callback
)
{
return
require
(
"child_process"
)
.
exec
(
command
,
opts
,
callback
)
;
}
)
;
describe
(
"Reference"
,
function
(
)
{
var
NodeGit
=
require
(
"../../"
)
;
var
Repository
=
NodeGit
.
Repository
;
var
Reference
=
NodeGit
.
Reference
;
var
reposPath
=
local
(
"../repos/workdir"
)
;
before
(
function
(
)
{
var
test
=
this
;
return
exec
(
"git reset --hard origin/master"
,
{
cwd
:
reposPath
}
)
.
then
(
function
(
)
{
return
Repository
.
open
(
reposPath
)
;
}
)
.
then
(
function
(
repository
)
{
test
.
repository
=
repository
;
return
repository
.
getReference
(
"refs/heads/master"
)
;
}
)
.
then
(
function
(
reference
)
{
test
.
reference
=
reference
;
}
)
;
}
)
;
it
(
"can look up a reference"
,
function
(
)
{
assert
.
ok
(
this
.
reference
instanceof
Reference
)
;
}
)
;
it
(
"can determine if the reference is symbolic"
,
function
(
)
{
assert
.
equal
(
this
.
reference
.
isSymbolic
(
)
,
false
)
;
}
)
;
it
(
"will return undefined looking up the symbolic target if not symbolic"
,
function
(
)
{
assert
(
this
.
reference
.
symbolicTarget
(
)
===
undefined
)
;
}
)
;
it
(
"can look up the HEAD sha"
,
function
(
)
{
return
Reference
.
nameToId
(
this
.
repository
,
"HEAD"
)
.
then
(
function
(
oid
)
{
var
sha
=
oid
.
allocfmt
(
)
;
assert
.
equal
(
sha
,
"32789a79e71fbc9e04d3eff7425e1771eb595150"
)
;
}
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL