FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit.nodegit/test/tests/blob.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
/
blob.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
53 lines (41 loc) · 1.34 KB
Breadcrumbs
nodegit.nodegit
/
test
/
tests
/
blob.js
Copy path
File metadata and controls
53 lines (41 loc) · 1.34 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
var
assert
=
require
(
"assert"
)
;
var
path
=
require
(
"path"
)
;
var
local
=
path
.
join
.
bind
(
path
,
__dirname
)
;
describe
(
"Blob"
,
function
(
)
{
var
NodeGit
=
require
(
"../../"
)
;
var
Oid
=
NodeGit
.
Oid
;
var
Repository
=
NodeGit
.
Repository
;
var
FileMode
=
NodeGit
.
TreeEntry
.
FILEMODE
;
var
reposPath
=
local
(
"../repos/workdir"
)
;
var
oid
=
"111dd657329797f6165f52f5085f61ac976dcf04"
;
beforeEach
(
function
(
)
{
var
test
=
this
;
return
Repository
.
open
(
reposPath
)
.
then
(
function
(
repository
)
{
test
.
repository
=
repository
;
return
repository
.
getBlob
(
oid
)
;
}
)
.
then
(
function
(
blob
)
{
test
.
blob
=
blob
;
}
)
;
}
)
;
it
(
"can provide content as a buffer"
,
function
(
)
{
var
contents
=
this
.
blob
.
content
(
)
;
assert
.
ok
(
Buffer
.
isBuffer
(
contents
)
)
;
}
)
;
it
(
"can provide content as a string"
,
function
(
)
{
var
contents
=
this
.
blob
.
toString
(
)
;
assert
.
equal
(
typeof
contents
,
"string"
)
;
assert
.
equal
(
contents
.
slice
(
0
,
7
)
,
"@import"
)
;
}
)
;
it
(
"can determine if a blob is not a binary"
,
function
(
)
{
assert
.
equal
(
this
.
blob
.
filemode
(
)
,
FileMode
.
BLOB
)
;
}
)
;
it
(
"can get a blob with an Oid object"
,
function
(
)
{
var
oidObject
=
Oid
.
fromString
(
oid
)
;
return
this
.
repository
.
getBlob
(
oidObject
)
.
then
(
function
(
blob
)
{
assert
.
equal
(
blob
.
id
(
)
.
toString
(
)
,
oid
)
;
}
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL