Skip to content

Commit

Permalink
Merge pull request #231 from adlnet/timestamp-iso-8601
Browse files Browse the repository at this point in the history
tests were successful with updates to ADL, committing
  • Loading branch information
vbhayden authored Apr 13, 2018
2 parents 85bc752 + 0d3b24b commit 3fdb746
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 3 deletions.
33 changes: 31 additions & 2 deletions test/v1_0_2/configs/statements.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
var VALID_VERSION_1_0 = '1.0';
var VALID_VERSION_1_0_9 = '1.0.9';

// From SPEC Issue: https://github.com/adlnet/xAPI-Spec/issues/1073
var INVALID_DATE_00 = "2008-09-15T15:53:00.601-00";
var INVALID_DATE_0000 = "2008-09-15T15:53:00.601-0000";
var INVALID_DATE_00_00 = "2008-09-15T15:53:00.601-00:00";

// configures tests
module.exports.config = function () {
return [
Expand Down Expand Up @@ -133,7 +138,31 @@
{timestamp: INVALID_DATE}
],
expect: [400]
}
},
{
name: 'statement "template" invalid date',
templates: [
{statement: '{{statements.default}}'},
{timestamp: INVALID_DATE_00}
],
expect: [400]
},
{
name: 'statement "template" invalid date',
templates: [
{statement: '{{statements.default}}'},
{timestamp: INVALID_DATE_0000}
],
expect: [400]
},
{
name: 'statement "template" invalid date',
templates: [
{statement: '{{statements.default}}'},
{timestamp: INVALID_DATE_00_00}
],
expect: [400]
},
]
},
{
Expand All @@ -154,7 +183,7 @@
{timestamp: INVALID_DATE}
],
expect: [400]
}
},
]
},
{
Expand Down
53 changes: 52 additions & 1 deletion test/v1_0_3/configs/timestamps.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// defines overwriting data
var INVALID_DATE = '01/011/2015';
var INVALID_STRING = 'should fail';
var INVALID_DATE_00 = "2008-09-15T15:53:00.601-00";
var INVALID_DATE_0000 = "2008-09-15T15:53:00.601-0000";
var INVALID_DATE_00_00 = "2008-09-15T15:53:00.601-00:00";

// configures tests
module.exports.config = function () {
Expand All @@ -37,6 +40,30 @@
],
expect: [400]
},
{
name: 'statement "template" invalid date in timestamp: did not reject statement timestmap with -00 offset',
templates: [
{statement: '{{statements.default}}'},
{timestamp: INVALID_DATE_00}
],
expect: [400]
},
{
name: 'statement "template" invalid date in timestamp: did not reject statement timestmap with -0000 offset',
templates: [
{statement: '{{statements.default}}'},
{timestamp: INVALID_DATE_0000}
],
expect: [400]
},
{
name: 'statement "template" invalid date in timestamp: did not reject statement timestmap with -00:00 offset',
templates: [
{statement: '{{statements.default}}'},
{timestamp: INVALID_DATE_00_00}
],
expect: [400]
},
{
name: 'substatement "template" invalid string in timestamp',
templates: [
Expand All @@ -52,7 +79,31 @@
{timestamp: INVALID_DATE}
],
expect: [400]
}
},
{
name: 'substatement "template" invalid date in timestamp: did not reject substatement timestamp with -00 offset',
templates: [
{statement: '{{statements.default}}'},
{timestamp: INVALID_DATE_00}
],
expect: [400]
},
{
name: 'substatement "template" invalid date in timestamp: did not reject substatement timestamp with -0000 offset',
templates: [
{statement: '{{statements.default}}'},
{timestamp: INVALID_DATE_0000}
],
expect: [400]
},
{
name: 'substatement "template" invalid date in timestamp: did not reject substatement timestamp with -00:00 offset',
templates: [
{statement: '{{statements.default}}'},
{timestamp: INVALID_DATE_00_00}
],
expect: [400]
},
]
}
];
Expand Down

0 comments on commit 3fdb746

Please sign in to comment.