Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Site.js
lib
JSDB
Commits
d6904f91
Commit
d6904f91
authored
Feb 26, 2021
by
Aral Balkan
Browse files
Code coverage back at 100%
parent
f9a3db2e
Changes
4
Hide whitespace changes
Inline
Side-by-side
lib/JSTable.js
View file @
d6904f91
...
...
@@ -44,8 +44,7 @@ export default class JSTable extends EventEmitter {
// Either loads the table at the passed table path (default) or, if
// data is passed, creates a new table at table path, populating
// it with the passed data.
constructor
(
tablePath
,
data
=
null
,
options
=
{
compactOnLoad
:
true
,
alwaysUseLineByLineLoads
:
false
}
)
{
constructor
(
tablePath
,
data
=
null
,
options
=
{
compactOnLoad
:
true
,
alwaysUseLineByLineLoads
:
false
})
{
super
()
this
.
tablePath
=
tablePath
...
...
@@ -78,6 +77,8 @@ export default class JSTable extends EventEmitter {
// NB. we are returning the data proxy, not an
// instance of JSTable. Use accordingly.
// Note: coverage ignore is due to this bug in c8: https://github.com/bcoe/c8/issues/290
/* c8 ignore next 2 */
return
this
.
#
dataProxy
}
...
...
lib/QuerySanitiser.js
View file @
d6904f91
...
...
@@ -303,12 +303,12 @@ export default class QuerySanitiser {
result
=
data
.
filter
(
function
(
value
)
{
try
{
return
query
(
value
)
}
catch
(
error
)
/*
istanbul
ignore
nex
t */
{
}
catch
(
error
)
/*
c8
ignore
star
t */
{
// Unexpected error: something went wrong while executing the query.
// (This should not happen as all errors should have been caught before this point.)
log
(
'
💾 ❨JSDB❩ Warning: query function threw unexpected error; rejecting.
'
,
queryString
,
error
)
return
false
}
}
/* c8 ignore stop */
})
}
...
...
lib/Util.js
View file @
d6904f91
...
...
@@ -34,6 +34,6 @@ export function log (...args) {
if
(
process
.
env
.
QUIET
)
{
return
}
/
/ istanbul
ignore next
/
* c8
ignore next
*/
console
.
log
(...
args
)
}
test/index.js
View file @
d6904f91
...
...
@@ -153,7 +153,7 @@ test('basic persistence', t => {
t
.
strictEquals
(
dehydrate
(
actualTableSourceBeforeCompaction
),
dehydrate
(
expectedTableSourceBeforeCompaction
),
'
table source is as expected before compaction
'
)
//
// Table loading (
requir
e).
// Table loading (
all at onc
e).
//
const
inMemoryStateOfPeopleTableFromOriginalDatabase
=
JSON
.
stringify
(
db
.
people
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment