FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/test/tests/odb.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
/
odb.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
61 lines (49 loc) · 1.55 KB
Breadcrumbs
nodegit
/
test
/
tests
/
odb.js
Copy path
File metadata and controls
61 lines (49 loc) · 1.55 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
var
assert
=
require
(
"assert"
)
;
var
path
=
require
(
"path"
)
;
var
local
=
path
.
join
.
bind
(
path
,
__dirname
)
;
describe
(
"Odb"
,
function
(
)
{
var
NodeGit
=
require
(
"../../"
)
;
var
Repository
=
NodeGit
.
Repository
;
var
Oid
=
NodeGit
.
Oid
;
var
Obj
=
NodeGit
.
Object
;
var
reposPath
=
local
(
"../repos/workdir"
)
;
beforeEach
(
function
(
)
{
var
test
=
this
;
return
Repository
.
open
(
reposPath
)
.
then
(
function
(
repo
)
{
test
.
repo
=
repo
;
return
repo
;
}
)
.
then
(
function
(
repo
)
{
return
repo
.
odb
(
)
;
}
)
.
then
(
function
(
odb
)
{
test
.
odb
=
odb
;
return
odb
;
}
)
;
}
)
;
it
(
"can read raw objects directly from the odb using an OID"
,
function
(
)
{
var
oid
=
Oid
.
fromString
(
"32789a79e71fbc9e04d3eff7425e1771eb595150"
)
;
return
this
.
odb
.
read
(
oid
)
.
then
(
function
(
object
)
{
assert
.
equal
(
object
.
type
(
)
,
Obj
.
TYPE
.
COMMIT
)
;
}
)
;
}
)
;
it
(
"can read objects directly from the odb using a string"
,
function
(
)
{
return
this
.
odb
.
read
(
"32789a79e71fbc9e04d3eff7425e1771eb595150"
)
.
then
(
function
(
object
)
{
assert
.
equal
(
object
.
type
(
)
,
Obj
.
TYPE
.
COMMIT
)
;
}
)
;
}
)
;
it
(
"can write raw objects to git"
,
function
(
)
{
var
obj
=
"test data"
;
var
odb
=
this
.
odb
;
return
odb
.
write
(
obj
,
obj
.
length
,
Obj
.
TYPE
.
BLOB
)
.
then
(
function
(
oid
)
{
assert
.
ok
(
oid
instanceof
Oid
)
;
return
odb
.
read
(
oid
)
;
}
)
.
then
(
function
(
object
)
{
assert
.
equal
(
object
.
type
(
)
,
Obj
.
TYPE
.
BLOB
)
;
assert
.
equal
(
object
.
toString
(
)
,
obj
)
;
assert
.
equal
(
object
.
size
(
)
,
obj
.
length
)
;
}
)
;
}
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL