Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('from xs:gMonthDay', () =>
chai.assert.deepEqual(
castToType(
createAtomicValue(DateTime.fromString('--10-10+10:30'), 'xs:gMonthDay'),
'xs:gMonthDay'
),
createAtomicValue(DateTime.fromString('--10-10+10:30'), 'xs:gMonthDay')
));
it('from xs:gDay (throws XPTY0004)', () =>
it('from xs:dateTime', () =>
chai.assert.deepEqual(
castToType(
createAtomicValue(
DateTime.fromString('2000-10-10T10:10:10+10:30'),
'xs:dateTime'
),
'xs:date'
),
createAtomicValue(DateTime.fromString('2000-10-10+10:30'), 'xs:date')
));
it('from xs:time (throws XPTY0004)', () =>
it('from xs:string', () =>
chai.assert.deepEqual(
castToType(
createAtomicValue('736F6D65206261736536342074657874', 'xs:string'),
'xs:hexBinary'
),
createAtomicValue('736F6D65206261736536342074657874', 'xs:hexBinary')
));
it('from xs:float (throws XPTY0004)', () =>
it('from xs:dayTimeDuration', () =>
chai.assert.deepEqual(
castToType(
createAtomicValue(DayTimeDuration.fromString('P10D'), 'xs:dayTimeDuration'),
'xs:duration'
),
createAtomicValue(Duration.fromString('P10D'), 'xs:duration')
));
it('from xs:dateTime (throws XPTY0004)', () =>
it('from xs:gYear', () =>
chai.assert.deepEqual(
castToType(
createAtomicValue(DateTime.fromString('2000+10:30'), 'xs:gYear'),
'xs:gYear'
),
createAtomicValue(DateTime.fromString('2000+10:30'), 'xs:gYear')
));
it('from xs:gMonthDay (throws XPTY0004)', () =>
it('from xs:untypedAtomic', () =>
chai.assert.deepEqual(
castToType(createAtomicValue('10.10', 'xs:untypedAtomic'), 'xs:float'),
createAtomicValue(10.1, 'xs:float')
));
it('from xs:string', () =>
() =>
castToType(
createAtomicValue(DateTime.fromString('---10+10:30'), 'xs:gDay'),
'xs:boolean'
),
'XPTY0004'
() =>
castToType(
createAtomicValue('21FE3A44123C21FE3A44123C', 'xs:hexBinary'),
'xs:time'
),
'XPTY0004'
() => castToType(createAtomicValue('string', 'xs:untypedAtomic'), 'xs:NOTATION'),
'XPST0080'
() =>
castToType(
createAtomicValue(DateTime.fromString('2000-10+10:30'), 'xs:gYearMonth'),
'xs:gDay'
),
'XPTY0004'