FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/test/tests/note.js at master · nodegit/nodegit · GitHub
nodegit
nodegit
Repository navigation
Code
Issues
344
(344)
Pull requests
21
(21)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
test
/
tests
/
note.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
71 lines (59 loc) · 2.04 KB
Breadcrumbs
nodegit
/
test
/
tests
/
note.js
Copy path
File metadata and controls
71 lines (59 loc) · 2.04 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
var
assert
=
require
(
"assert"
)
;
var
path
=
require
(
"path"
)
;
var
local
=
path
.
join
.
bind
(
path
,
__dirname
)
;
describe
(
"Note"
,
function
(
)
{
var
NodeGit
=
require
(
"../../"
)
;
var
Note
=
NodeGit
.
Note
;
var
Signature
=
NodeGit
.
Signature
;
var
reposPath
=
local
(
"../repos/workdir"
)
;
beforeEach
(
function
(
)
{
var
test
=
this
;
return
NodeGit
.
Repository
.
open
(
reposPath
)
.
then
(
function
(
repository
)
{
test
.
repository
=
repository
;
return
repository
.
getMasterCommit
(
)
.
then
(
function
(
commit
)
{
test
.
commit
=
commit
;
}
)
;
}
)
;
}
)
;
it
(
"can be created"
,
function
(
)
{
var
sha
=
this
.
commit
.
id
(
)
;
var
sig
=
Signature
.
create
(
"John"
,
"john@doe.com"
,
Date
.
now
(
)
,
0
)
;
var
noteRef
=
"refs/notes/commits"
;
return
Note
.
create
(
this
.
repository
,
noteRef
,
sig
,
sig
,
sha
,
"Testing!"
,
1
)
;
}
)
;
it
(
"can be read"
,
function
(
)
{
var
sha
=
this
.
commit
.
id
(
)
;
var
noteRef
=
"refs/notes/commits"
;
return
Note
.
read
(
this
.
repository
,
noteRef
,
sha
)
.
then
(
function
(
note
)
{
assert
.
equal
(
note
.
message
(
)
,
"Testing!"
)
;
}
)
;
}
)
;
it
(
"can iterate all notes"
,
function
(
)
{
var
test
=
this
;
var
noteRef
=
"refs/notes/commits"
;
var
ref
=
null
;
return
Note
.
foreach
(
this
.
repository
,
noteRef
,
function
(
blobId
,
objectId
)
{
ref
=
objectId
;
}
)
.
then
(
function
(
)
{
return
NodeGit
.
Note
.
read
(
test
.
repository
,
noteRef
,
ref
)
.
then
(
function
(
note
)
{
assert
.
equal
(
note
.
message
(
)
,
"Testing!"
)
;
}
)
;
}
)
;
}
)
;
it
(
"can be removed"
,
function
(
done
)
{
var
test
=
this
;
var
sha
=
this
.
commit
.
id
(
)
;
var
noteRef
=
"refs/notes/commits"
;
var
sig
=
Signature
.
create
(
"John"
,
"john@doe.com"
,
Date
.
now
(
)
,
0
)
;
Note
.
create
(
this
.
repository
,
noteRef
,
sig
,
sig
,
sha
,
"Testing!"
,
1
)
.
then
(
(
noteSha
)
=>
Note
.
remove
(
this
.
repository
,
noteRef
,
sig
,
sig
,
sha
)
)
.
then
(
function
(
)
{
return
Note
.
read
(
test
.
repository
,
noteRef
,
sha
)
.
catch
(
function
(
ex
)
{
assert
.
equal
(
ex
.
message
,
"note could not be found"
)
;
done
(
)
;
}
)
;
}
)
.
catch
(
done
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL