Open
Description
Hi there,
While running the CTS, sometimes i get a failure like the following:
"tests": [
{
"title": "Special Data Types and Rules (Data 4.0)",
"name": "Special Data Types and Rules",
"requirement": [
"Data.md#4.0"
],
"log": "",
"status": "failed",
"tests": [
{
"title": "A Timestamp MUST preserve precision to at least milliseconds, 3 decimal points beyond seconds. (Data 4.5.s1.b3, XAPI-00122)",
"name": "A Timestamp MUST preserve precision to at least milliseconds, 3 decimal points beyond seconds.",
"requirement": [
"Data.md#4.5.s1.b3"
],
"log": "",
"status": "failed",
"tests": [
{
"title": "retrieve statements, test a stored property",
"name": "retrieve statements, test a stored property",
...
"status": "failed",
"error": "AssertionError: expected 0 to be above 0",
"tests": []
}
]
}
]
}
]
I believe this is caused by a failed expect
in the .js
file in the subject line inside the milliChecker
function starting on line #470.
The failure seems to be caused by timestamps with a milliseconds field that have 0
as their last decimal digit.
The following code demonstrates the issue:
import moment from 'moment';
import chai from 'chai';
var expect = chai.expect;
var tv = [
"2025-01-17T00:52:14.590+00:00",
"2008-09-15T15:53:00.601Z",
"2025-01-17T00:52:14.591+00:00",
"2008-09-15T15:53:00.600Z"
];
for (let i = 0; i < tv.length; i++) {
try {
var ts = moment(tv[i], moment.ISO_8601);
expect(ts.isValid()).to.be.true;
var millis = ts._pf.parsedDateParts[6];
expect(isNaN(millis)).to.be.false;
expect(millis % 10).to.be.above(0);
console.info(`+ TV #${i} (${millis}) pass`);
} catch (x) {
console.error(`- TV #${i} (${millis}) fail: ${x.message}`);
continue
}
}
It outputs:
- TV #0 (590) fail: expected 0 to be above 0
+ TV #1 (601) pass
+ TV #2 (591) pass
- TV #3 (600) fail: expected 0 to be above 0
Would appreciate it if somebody can confirm if it's indeed a bug or a misunderstanding on my part.
cheers;
rsn
Metadata
Metadata
Assignees
Labels
No labels