Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
blendb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
pdts20
blendb
Commits
a97d836f
Commit
a97d836f
authored
8 years ago
by
Eduardo L. Buratti
Browse files
Options
Downloads
Patches
Plain Diff
Add test framework
parent
d2be408e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
package.json
+4
-0
4 additions, 0 deletions
package.json
test/global.js
+29
-0
29 additions, 0 deletions
test/global.js
test/mocha.opts
+9
-0
9 additions, 0 deletions
test/mocha.opts
test/util/hash.spec.js
+74
-0
74 additions, 0 deletions
test/util/hash.spec.js
with
116 additions
and
0 deletions
package.json
+
4
−
0
View file @
a97d836f
...
@@ -32,5 +32,9 @@
...
@@ -32,5 +32,9 @@
"
mongodb
"
:
"
^2.2.5
"
,
"
mongodb
"
:
"
^2.2.5
"
,
"
osprey
"
:
"
^0.3.2
"
,
"
osprey
"
:
"
^0.3.2
"
,
"
raml2html
"
:
"
^2.4.0
"
"
raml2html
"
:
"
^2.4.0
"
},
"devDependencies"
:
{
"
chai
"
:
"
^3.5.0
"
,
"
mocha
"
:
"
^3.0.2
"
}
}
}
}
This diff is collapsed.
Click to expand it.
test/global.js
0 → 100644
+
29
−
0
View file @
a97d836f
/*
* Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana
*
* This file is part of blendb.
*
* blendb is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* blendb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with blendb. If not, see <http://www.gnu.org/licenses/>.
*/
'
use strict
'
;
process
.
env
.
NODE_ENV
=
'
test
'
;
global
.
expect
=
require
(
'
chai
'
).
expect
;
// Add the ./src directory to require's search path to facilitate import
// modules later on (avoiding the require('../../../../module') problem).
require
(
'
app-module-path
'
).
addPath
(
__dirname
+
'
/../src
'
);
This diff is collapsed.
Click to expand it.
test/mocha.opts
0 → 100644
+
9
−
0
View file @
a97d836f
--require ./test/global.js
--reporter spec
--ui bdd
--recursive
--colors
--timeout 60000
--slow 300
--check-leaks
--globals expect
This diff is collapsed.
Click to expand it.
test/util/hash.spec.js
0 → 100644
+
74
−
0
View file @
a97d836f
/*
* Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
* Departamento de Informatica - Universidade Federal do Parana
*
* This file is part of blendb.
*
* blendb is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* blendb is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with blendb. If not, see <http://www.gnu.org/licenses/>.
*/
'
use strict
'
;
/* globals expect */
/* jshint -W024 */
/* jshint expr:true, maxlen:false */
/* jscs:disable maximumLineLength */
const
hash
=
require
(
'
util/hash
'
);
describe
(
'
hash utility library
'
,
()
=>
{
it
(
'
should generate a sha1 hash for a collection of objects
'
,
()
=>
{
let
h
=
hash
.
sha1
(
'
test
'
,
{
obj
:
'
test
'
},
[
'
list
'
,
'
of
'
,
'
things
'
]);
expect
(
h
).
to
.
be
.
a
(
'
string
'
);
expect
(
h
).
to
.
not
.
be
.
empty
;
});
it
(
'
should generate the same hash for the same input
'
,
()
=>
{
let
h1
=
hash
.
sha1
(
'
test
'
,
{
obj
:
'
test
'
},
[
'
list
'
,
'
of
'
,
'
things
'
]);
let
h2
=
hash
.
sha1
(
'
test
'
,
{
obj
:
'
test
'
},
[
'
list
'
,
'
of
'
,
'
things
'
]);
expect
(
h1
).
to
.
be
.
a
(
'
string
'
);
expect
(
h2
).
to
.
be
.
a
(
'
string
'
);
expect
(
h1
).
to
.
be
.
equal
(
h2
);
});
it
(
'
should generate the same hash for different order of input
'
,
()
=>
{
let
h1
=
hash
.
sha1
(
'
test
'
,
{
obj
:
'
test
'
},
[
'
list
'
,
'
of
'
,
'
things
'
]);
let
h2
=
hash
.
sha1
(
'
test
'
,
[
'
list
'
,
'
of
'
,
'
things
'
],
{
obj
:
'
test
'
});
expect
(
h1
).
to
.
be
.
a
(
'
string
'
);
expect
(
h2
).
to
.
be
.
a
(
'
string
'
);
expect
(
h1
).
to
.
be
.
equal
(
h2
);
});
it
(
'
should not generate the same hash for distinct input
'
,
()
=>
{
let
h1
=
hash
.
sha1
(
'
test
'
,
{
obj
:
'
test
'
},
[
'
list
'
,
'
of
'
,
'
things
'
]);
let
h2
=
hash
.
sha1
(
'
test
'
,
{
obj
:
'
test
'
,
x
:
true
},
[
'
list
'
,
'
of
'
,
'
things
'
]);
expect
(
h1
).
to
.
be
.
a
(
'
string
'
);
expect
(
h2
).
to
.
be
.
a
(
'
string
'
);
expect
(
h1
).
to
.
not
.
be
.
equal
(
h2
);
});
it
(
'
should not generate the same hash for different order in deep lists
'
,
()
=>
{
let
h1
=
hash
.
sha1
(
'
test
'
,
{
obj
:
'
test
'
},
[
'
list
'
,
'
of
'
,
'
things
'
]);
let
h2
=
hash
.
sha1
(
'
test
'
,
{
obj
:
'
test
'
},
[
'
of
'
,
'
list
'
,
'
things
'
]);
expect
(
h1
).
to
.
be
.
a
(
'
string
'
);
expect
(
h2
).
to
.
be
.
a
(
'
string
'
);
expect
(
h1
).
to
.
not
.
be
.
equal
(
h2
);
});
});
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