-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test improvements, longterm quick insulin service, react native paper
- Loading branch information
1 parent
40e2978
commit 27f66f2
Showing
5 changed files
with
101 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,41 @@ | ||
import {test, expect} from '@jest/globals' | ||
import { Trend, TrendService } from '../TrendService' | ||
import {Trend, TrendService} from '../TrendService' | ||
|
||
describe('trend service', () => { | ||
|
||
test.each([ | ||
[{trend: Trend.DOWN}, {trend:Trend.UP} , {trend: Trend.STABLE} , Trend.STABLE], | ||
[{trend: Trend.DOWN}, {trend:Trend.DOWN} , {trend: Trend.DOWN} , Trend.DOWN], | ||
[{trend: Trend.UP}, {trend:Trend.UP} , {trend: Trend.UP} , Trend.UP], | ||
[{trend: Trend.STABLE}, {trend:Trend.STABLE} , {trend: Trend.STABLE} , Trend.STABLE], | ||
]) | ||
[ | ||
{trend: Trend.DOWN}, | ||
{trend: Trend.UP}, | ||
{trend: Trend.STABLE}, | ||
Trend.STABLE, | ||
], | ||
[{trend: Trend.DOWN}, {trend: Trend.DOWN}, {trend: Trend.DOWN}, Trend.DOWN], | ||
[{trend: Trend.UP}, {trend: Trend.UP}, {trend: Trend.UP}, Trend.UP], | ||
[ | ||
{trend: Trend.STABLE}, | ||
{trend: Trend.STABLE}, | ||
{trend: Trend.STABLE}, | ||
Trend.STABLE, | ||
], | ||
])( | ||
' when trend1 = %j and trend2 = %j and trend3 = %j, computed trend must give %s', | ||
( | ||
' when trend1 = %j and trend2 = %j and trend3 = %j, computed trend must give %s', | ||
(trend1: {trend: Trend}, trend2: {trend: Trend}, trend3: {trend: Trend}, expected: Trend) => { | ||
let trendService = new TrendService() | ||
expect(trendService.findTrend([trend1, trend2, trend3])).toEqual(expected) | ||
} | ||
) | ||
}) | ||
|
||
it('throws error when not enough measures are provided', () => { | ||
let trendService = new TrendService() | ||
let t = () => {trendService.findTrend([{trend: Trend.DOWN}, {trend: Trend.DOWN}])} | ||
trend1: {trend: Trend}, | ||
trend2: {trend: Trend}, | ||
trend3: {trend: Trend}, | ||
expected: Trend, | ||
) => { | ||
let trendService = new TrendService() | ||
expect(trendService.findTrend([trend1, trend2, trend3])).toEqual(expected) | ||
}, | ||
) | ||
}) | ||
|
||
expect(t).toThrowError() | ||
it('throws error when not enough measures are provided', () => { | ||
let trendService = new TrendService() | ||
let t = () => { | ||
trendService.findTrend([{trend: Trend.DOWN}, {trend: Trend.DOWN}]) | ||
} | ||
|
||
}) | ||
expect(t).toThrowError() | ||
}) |