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
7e0456c1
Commit
7e0456c1
authored
6 years ago
by
emelko
Browse files
Options
Downloads
Patches
Plain Diff
Adding unit tests to all possible mucus feeling/texture combinations
parent
9ab4bd0d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
components/mucus.js
+2
-1
2 additions, 1 deletion
components/mucus.js
lib/sensiplan-mucus.js
+16
-0
16 additions, 0 deletions
lib/sensiplan-mucus.js
test/sensiplan-mucus.spec.js
+80
-0
80 additions, 0 deletions
test/sensiplan-mucus.spec.js
with
98 additions
and
1 deletion
components/mucus.js
+
2
−
1
View file @
7e0456c1
...
@@ -12,6 +12,7 @@ import {
...
@@ -12,6 +12,7 @@ import {
mucusFeeling
as
feelingLabels
,
mucusFeeling
as
feelingLabels
,
mucusTexture
as
textureLabels
mucusTexture
as
textureLabels
}
from
'
../labels/labels
'
}
from
'
../labels/labels
'
import
computeSensiplanValue
from
'
../lib/sensiplan-mucus
'
export
default
class
Mucus
extends
Component
{
export
default
class
Mucus
extends
Component
{
constructor
(
props
)
{
constructor
(
props
)
{
...
@@ -137,11 +138,11 @@ export default class Mucus extends Component {
...
@@ -137,11 +138,11 @@ export default class Mucus extends Component {
saveMucus
(
this
.
cycleDay
,
{
saveMucus
(
this
.
cycleDay
,
{
feeling
:
this
.
state
.
currentFeelingValue
,
feeling
:
this
.
state
.
currentFeelingValue
,
texture
:
this
.
state
.
currentTextureValue
,
texture
:
this
.
state
.
currentTextureValue
,
computedValue
:
computeSensiplanValue
(
this
.
state
.
currentFeelingValue
,
this
.
state
.
currentTextureValue
),
exclude
:
this
.
state
.
exclude
exclude
:
this
.
state
.
exclude
})
})
this
.
showView
(
'
dayView
'
)
this
.
showView
(
'
dayView
'
)
}}
}}
// FIXME: find out how disabled works when 2 values need to be checked
disabled
=
{
this
.
state
.
currentFeelingValue
===
-
1
||
this
.
state
.
currentTextureValue
===
-
1
}
disabled
=
{
this
.
state
.
currentFeelingValue
===
-
1
||
this
.
state
.
currentTextureValue
===
-
1
}
title
=
"
Save
"
>
title
=
"
Save
"
>
<
/Button
>
<
/Button
>
...
...
This diff is collapsed.
Click to expand it.
lib/sensiplan-mucus.js
0 → 100644
+
16
−
0
View file @
7e0456c1
export
default
function
(
feeling
,
texture
)
{
const
feelingMapping
=
{
0
:
0
,
1
:
1
,
2
:
2
,
3
:
4
}
const
textureMapping
=
{
0
:
0
,
1
:
3
,
2
:
4
}
const
nfpFeelingValue
=
feelingMapping
[
feeling
]
const
nfpTextureValue
=
textureMapping
[
texture
]
return
Math
.
max
(
nfpFeelingValue
,
nfpTextureValue
)
}
This diff is collapsed.
Click to expand it.
test/sensiplan-mucus.spec.js
0 → 100644
+
80
−
0
View file @
7e0456c1
import
chai
from
'
chai
'
import
dirtyChai
from
'
dirty-chai
'
const
expect
=
chai
.
expect
chai
.
use
(
dirtyChai
)
import
getSensiplanMucus
from
'
../lib/sensiplan-mucus
'
describe
.
only
(
'
getSensiplanMucus
'
,
()
=>
{
describe
(
'
results in t for:
'
,
()
=>
{
it
(
'
dry feeling and no texture
'
,
function
()
{
const
sensiplanValue
=
getSensiplanMucus
(
0
,
0
)
expect
(
sensiplanValue
).
to
.
eql
(
0
)
})
})
describe
(
'
results in Ø for:
'
,
()
=>
{
it
(
'
no feeling and no texture
'
,
function
()
{
const
sensiplanValue
=
getSensiplanMucus
(
1
,
0
)
expect
(
sensiplanValue
).
to
.
eql
(
1
)
})
})
describe
(
'
results in f for:
'
,
()
=>
{
it
(
'
wet feeling and no texture
'
,
function
()
{
const
sensiplanValue
=
getSensiplanMucus
(
2
,
0
)
expect
(
sensiplanValue
).
to
.
eql
(
2
)
})
})
describe
(
'
results in S for:
'
,
()
=>
{
it
(
'
dry feeling and creamy texture
'
,
function
()
{
const
sensiplanValue
=
getSensiplanMucus
(
0
,
1
)
expect
(
sensiplanValue
).
to
.
eql
(
3
)
})
it
(
'
no feeling and creamy texture
'
,
function
()
{
const
sensiplanValue
=
getSensiplanMucus
(
1
,
1
)
expect
(
sensiplanValue
).
to
.
eql
(
3
)
})
it
(
'
wet feeling and creamy texture
'
,
function
()
{
const
sensiplanValue
=
getSensiplanMucus
(
2
,
1
)
expect
(
sensiplanValue
).
to
.
eql
(
3
)
})
})
describe
(
'
results in +S for:
'
,
()
=>
{
it
(
'
dry feeling and egg white texture
'
,
function
()
{
const
sensiplanValue
=
getSensiplanMucus
(
0
,
2
)
expect
(
sensiplanValue
).
to
.
eql
(
4
)
})
it
(
'
no feeling and egg white texture
'
,
function
()
{
const
sensiplanValue
=
getSensiplanMucus
(
1
,
2
)
expect
(
sensiplanValue
).
to
.
eql
(
4
)
})
it
(
'
wet feeling and egg white texture
'
,
function
()
{
const
sensiplanValue
=
getSensiplanMucus
(
2
,
2
)
expect
(
sensiplanValue
).
to
.
eql
(
4
)
})
it
(
'
slippery feeling and egg white texture
'
,
function
()
{
const
sensiplanValue
=
getSensiplanMucus
(
3
,
2
)
expect
(
sensiplanValue
).
to
.
eql
(
4
)
})
it
(
'
slippery feeling and creamy texture
'
,
function
()
{
const
sensiplanValue
=
getSensiplanMucus
(
3
,
1
)
expect
(
sensiplanValue
).
to
.
eql
(
4
)
})
it
(
'
slippery feeling and no texture
'
,
function
()
{
const
sensiplanValue
=
getSensiplanMucus
(
3
,
0
)
expect
(
sensiplanValue
).
to
.
eql
(
4
)
})
})
})
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