Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
79555eb4
Commit
79555eb4
authored
1 year ago
by
Benoit Lavenier
Browse files
Options
Downloads
Patches
Plain Diff
fix: fix a unit test, to create the server only when test starts
parent
795fc8fc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/dal/basic-dal-tests.ts
+12
-4
12 additions, 4 deletions
test/dal/basic-dal-tests.ts
with
12 additions
and
4 deletions
test/dal/basic-dal-tests.ts
+
12
−
4
View file @
79555eb4
...
@@ -16,6 +16,7 @@ import {PeerDTO} from "../../app/lib/dto/PeerDTO"
...
@@ -16,6 +16,7 @@ import {PeerDTO} from "../../app/lib/dto/PeerDTO"
import
{
Directory
}
from
"
../../app/lib/system/directory
"
import
{
Directory
}
from
"
../../app/lib/system/directory
"
import
{
DBBlock
}
from
"
../../app/lib/db/DBBlock
"
import
{
DBBlock
}
from
"
../../app/lib/db/DBBlock
"
import
{
Underscore
}
from
"
../../app/lib/common-libs/underscore
"
import
{
Underscore
}
from
"
../../app/lib/common-libs/underscore
"
import
{
ConfDTO
}
from
"
../../app/lib/dto/ConfDTO
"
;
var
should
=
require
(
'
should
'
);
var
should
=
require
(
'
should
'
);
var
assert
=
require
(
'
assert
'
);
var
assert
=
require
(
'
assert
'
);
...
@@ -102,15 +103,22 @@ var mocks = {
...
@@ -102,15 +103,22 @@ var mocks = {
}
}
};
};
let
fileDAL
:
FileDAL
let
conf
:
ConfDTO
;
let
fileDAL
:
FileDAL
;
describe
(
"
DAL
"
,
function
(){
describe
(
"
DAL
"
,
function
(){
before
(
async
()
=>
{
before
(
async
()
=>
{
conf
=
ConfDTO
.
complete
({
currency
:
"
meta_brouzouf
"
,
storage
:
{
transactions
:
true
}
});
let
params
=
await
Directory
.
getHomeParams
(
true
,
'
db0
'
);
let
params
=
await
Directory
.
getHomeParams
(
true
,
'
db0
'
);
fileDAL
=
new
FileDAL
(
params
,
async
(
name
:
string
)
=>
Directory
.
getHomeDB
(
true
,
name
),
async
(
name
:
string
)
=>
Directory
.
getHomeLevelDB
(
true
,
name
));
fileDAL
=
new
FileDAL
(
params
,
async
(
name
:
string
)
=>
Directory
.
getHomeDB
(
true
,
name
),
async
(
name
:
string
)
=>
Directory
.
getHomeLevelDB
(
true
,
name
));
await
fileDAL
.
init
(
{}
as
any
);
await
fileDAL
.
init
(
conf
);
return
fileDAL
.
saveConf
(
{
currency
:
"
meta_brouzouf
"
}
as
any
);
return
fileDAL
.
saveConf
(
conf
);
})
})
after
(()
=>
{
after
(()
=>
{
...
@@ -155,7 +163,7 @@ describe("DAL", function(){
...
@@ -155,7 +163,7 @@ describe("DAL", function(){
});
});
it
(
'
should be able to save a Block
'
,
async
()
=>
{
it
(
'
should be able to save a Block
'
,
async
()
=>
{
await
fileDAL
.
saveBlock
(
Underscore
.
extend
({
fork
:
false
}
as
any
,
mocks
.
block0
));
await
fileDAL
.
saveBlock
(
Underscore
.
extend
({
fork
:
false
}
as
any
,
mocks
.
block0
)
,
conf
);
let
block
=
(
await
fileDAL
.
getFullBlockOf
(
0
))
as
DBBlock
let
block
=
(
await
fileDAL
.
getFullBlockOf
(
0
))
as
DBBlock
block
.
should
.
have
.
property
(
'
hash
'
).
equal
(
mocks
.
block0
.
hash
);
block
.
should
.
have
.
property
(
'
hash
'
).
equal
(
mocks
.
block0
.
hash
);
block
.
should
.
have
.
property
(
'
signature
'
).
equal
(
mocks
.
block0
.
signature
);
block
.
should
.
have
.
property
(
'
signature
'
).
equal
(
mocks
.
block0
.
signature
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment