Skip to content

Commit

Permalink
Also add tests on the new function
Browse files Browse the repository at this point in the history
  • Loading branch information
rix0rrr committed Mar 12, 2020
1 parent 5df4201 commit 0353c16
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/@aws-cdk/core/test/test.duration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,22 @@ export = nodeunit.testCase({
test.done();
},

'toIsoString'(test: nodeunit.Test) {
test.equal(Duration.seconds(0).toIsoString(), 'PT0S');
test.equal(Duration.minutes(0).toIsoString(), 'PT0S');
test.equal(Duration.hours(0).toIsoString(), 'PT0S');
test.equal(Duration.days(0).toIsoString(), 'PT0S');

test.equal(Duration.seconds(5).toIsoString(), 'PT5S');
test.equal(Duration.minutes(5).toIsoString(), 'PT5M');
test.equal(Duration.hours(5).toIsoString(), 'PT5H');
test.equal(Duration.days(5).toIsoString(), 'PT5D');

test.equal(Duration.seconds(1 + 60 * (1 + 60 * (1 + 24))).toIsoString(), 'PT1D1H1M1S');

test.done();
},

'parse'(test: nodeunit.Test) {
test.equal(Duration.parse('PT0S').toSeconds(), 0);
test.equal(Duration.parse('PT0M').toSeconds(), 0);
Expand Down

0 comments on commit 0353c16

Please sign in to comment.