@@ -854,6 +854,53 @@ describe('cborld round trip', () => {
854854 expect ( decodedDocument ) . to . eql ( jsonldDocument ) ;
855855 } ) ;
856856
857+ it ( 'should handle wide dateTime range' , async ( ) => {
858+ const CONTEXT = {
859+ '@context' : {
860+ date : {
861+ '@id' : 'ex:date' ,
862+ '@type' : 'http://www.w3.org/2001/XMLSchema#dateTime'
863+ } ,
864+ }
865+ } ;
866+ const jsonldDocument = {
867+ '@context' : CONTEXT [ '@context' ] ,
868+ date : [
869+ '1000-01-01T00:00:00Z' ,
870+ '1960-01-01T00:00:00Z' ,
871+ '1960-01-01T23:59:59Z' ,
872+ '1969-12-31T23:59:59Z' ,
873+ '1970-01-01T00:00:00Z' ,
874+ '1970-01-01T00:00:01Z' ,
875+ '1970-12-31T23:59:59Z' ,
876+ '2000-01-01T00:00:00Z' ,
877+ '3000-01-01T00:00:00Z'
878+ // TODO: increase possible xsd:dateTime value coverage
879+ ]
880+ } ;
881+
882+ const documentLoader = url => {
883+ throw new Error ( `Refused to load URL "${ url } ".` ) ;
884+ } ;
885+
886+ const typeTable = new Map ( TYPE_TABLE ) ;
887+
888+ const cborldBytes = await encode ( {
889+ jsonldDocument,
890+ format : 'cbor-ld-1.0' ,
891+ registryEntryId : 1 ,
892+ documentLoader,
893+ typeTableLoader : ( ) => typeTable
894+ } ) ;
895+
896+ const decodedDocument = await decode ( {
897+ cborldBytes,
898+ documentLoader,
899+ typeTableLoader : ( ) => typeTable
900+ } ) ;
901+ expect ( decodedDocument ) . to . eql ( jsonldDocument ) ;
902+ } ) ;
903+
857904 it ( 'should revert remote type-scope' , async ( ) => {
858905 const CONTEXT_URL = 'urn:foo' ;
859906 const CONTEXT = {
0 commit comments