Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drip
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
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue 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
backup
Drip
Commits
5e060132
Commit
5e060132
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Add test for less than 6 low temps
parent
d1f29223
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/sensiplan.js
+1
-1
1 addition, 1 deletion
lib/sensiplan.js
test/sensiplan.spec.js
+22
-0
22 additions, 0 deletions
test/sensiplan.spec.js
with
23 additions
and
1 deletion
lib/sensiplan.js
+
1
−
1
View file @
5e060132
...
@@ -9,7 +9,7 @@ function detectTemperatureShift(temperaturesOfCycle) {
...
@@ -9,7 +9,7 @@ function detectTemperatureShift(temperaturesOfCycle) {
// if no shift has been detected, we collect low temps
// if no shift has been detected, we collect low temps
// after the shift has been detected, we count them as part
// after the shift has been detected, we count them as part
// of the higher temperature phase
// of the higher temperature phase
if
(
acc
.
low
.
length
<
7
)
{
if
(
acc
.
low
.
length
<
6
)
{
acc
.
low
.
push
(
curr
)
acc
.
low
.
push
(
curr
)
acc
.
ltl
=
Math
.
max
(...
acc
.
low
.
slice
(
-
6
))
acc
.
ltl
=
Math
.
max
(...
acc
.
low
.
slice
(
-
6
))
// TODO these are the same
// TODO these are the same
...
...
This diff is collapsed.
Click to expand it.
test/sensiplan.spec.js
+
22
−
0
View file @
5e060132
...
@@ -28,6 +28,28 @@ describe.only('sensiplan', () => {
...
@@ -28,6 +28,28 @@ describe.only('sensiplan', () => {
})
})
})
})
it
(
'
detects no temperature shift when there are no 6 low temps
'
,
function
()
{
const
tempShift
=
[
36.47
,
36.49
,
36.57
,
36.62
,
36.55
,
36.8
,
36.86
,
36.8
]
const
status
=
detectTemperatureShift
(
tempShift
)
expect
(
status
).
to
.
eql
({
low
:
[
36.45
,
36.5
,
36.55
,
36.6
,
36.55
,
36.8
],
ltl
:
36.8
,
high
:
[
36.85
,
36.8
],
shiftDetected
:
false
})
})
it
(
'
detects no temperature shift if the shift is not high enough
'
,
function
()
{
const
tempShift
=
[
36.57
,
36.7
,
36.47
,
36.49
,
36.57
,
36.62
,
36.55
,
36.8
,
36.86
,
36.8
]
const
status
=
detectTemperatureShift
(
tempShift
)
expect
(
status
).
to
.
eql
({
low
:
[
36.55
,
36.7
,
36.45
,
36.5
,
36.55
,
36.6
,
36.55
],
ltl
:
36.7
,
high
:
[
36.8
,
36.85
,
36.8
],
shiftDetected
:
false
})
})
it
(
'
detects missing temperature shift correctly
'
,
function
()
{
it
(
'
detects missing temperature shift correctly
'
,
function
()
{
const
noTempShift
=
[
36.7
,
36.57
,
36.47
,
36.49
,
36.57
,
36.62
,
36.55
,
36.8
,
36.86
,
36.77
]
const
noTempShift
=
[
36.7
,
36.57
,
36.47
,
36.49
,
36.57
,
36.62
,
36.55
,
36.8
,
36.86
,
36.77
]
const
status
=
detectTemperatureShift
(
noTempShift
)
const
status
=
detectTemperatureShift
(
noTempShift
)
...
...
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