File tree Expand file tree Collapse file tree 3 files changed +17
-24
lines changed Expand file tree Collapse file tree 3 files changed +17
-24
lines changed Original file line number Diff line number Diff line change 15
15
usage.
16
16
- The internal digest algorithm can be changed.
17
17
18
+ ### Removed
19
+ - ** BREAKING** : Remove ` application/nquads ` alias for ` application/n-quads ` .
20
+
18
21
## 8.3.2 - 2023-12-06
19
22
20
23
### Fixed
Original file line number Diff line number Diff line change @@ -579,8 +579,7 @@ jsonld.normalize = jsonld.canonize = async function(input, options) {
579
579
} , options . canonizeOptions || null ) ;
580
580
581
581
if ( 'inputFormat' in options ) {
582
- if ( options . inputFormat !== 'application/n-quads' &&
583
- options . inputFormat !== 'application/nquads' ) {
582
+ if ( options . inputFormat !== 'application/n-quads' ) {
584
583
throw new JsonLdError (
585
584
'Unknown canonicalization input format.' ,
586
585
'jsonld.CanonizeError' ) ;
@@ -700,8 +699,7 @@ jsonld.toRDF = async function(input, options) {
700
699
// output RDF dataset
701
700
const dataset = _toRDF ( expanded , options ) ;
702
701
if ( options . format ) {
703
- if ( options . format === 'application/n-quads' ||
704
- options . format === 'application/nquads' ) {
702
+ if ( options . format === 'application/n-quads' ) {
705
703
return NQuads . serialize ( dataset ) ;
706
704
}
707
705
throw new JsonLdError (
@@ -1007,7 +1005,6 @@ jsonld.unregisterRDFParser = function(contentType) {
1007
1005
1008
1006
// register the N-Quads RDF parser
1009
1007
jsonld . registerRDFParser ( 'application/n-quads' , NQuads . parse ) ;
1010
- jsonld . registerRDFParser ( 'application/nquads' , NQuads . parse ) ;
1011
1008
1012
1009
/* URL API */
1013
1010
jsonld . url = require ( './url' ) ;
Original file line number Diff line number Diff line change @@ -143,19 +143,18 @@ describe('other toRDF tests', () => {
143
143
} ) ;
144
144
} ) ;
145
145
146
- it ( 'should handle deprecated N-Quads format' , done => {
146
+ it ( 'should fail for deprecated N-Quads format' , done => {
147
147
const doc = {
148
148
"@id" : "https://example.com/" ,
149
149
"https://example.com/test" : "test"
150
150
} ;
151
151
const p = jsonld . toRDF ( doc , { format : 'application/nquads' } ) ;
152
152
assert ( p instanceof Promise ) ;
153
- p . catch ( e => {
154
- assert . ifError ( e ) ;
155
- } ) . then ( output => {
156
- assert . equal (
157
- output ,
158
- '<https://example.com/> <https://example.com/test> "test" .\n' ) ;
153
+ p . then ( ( ) => {
154
+ assert . fail ( ) ;
155
+ } ) . catch ( e => {
156
+ assert ( e ) ;
157
+ assert . equal ( e . name , 'jsonld.UnknownFormat' ) ;
159
158
done ( ) ;
160
159
} ) ;
161
160
} ) ;
@@ -232,21 +231,15 @@ describe('other fromRDF tests', () => {
232
231
} ) ;
233
232
} ) ;
234
233
235
- it ( 'should handle deprecated N-Quads format' , done => {
234
+ it ( 'should fail for deprecated N-Quads format' , done => {
236
235
const nq = '<https://example.com/> <https://example.com/test> "test" .\n' ;
237
236
const p = jsonld . fromRDF ( nq , { format : 'application/nquads' } ) ;
238
237
assert ( p instanceof Promise ) ;
239
- p . catch ( e => {
240
- assert . ifError ( e ) ;
241
- } ) . then ( output => {
242
- assert . deepEqual (
243
- output ,
244
- [ {
245
- "@id" : "https://example.com/" ,
246
- "https://example.com/test" : [ {
247
- "@value" : "test"
248
- } ]
249
- } ] ) ;
238
+ p . then ( ( ) => {
239
+ assert . fail ( ) ;
240
+ } ) . catch ( e => {
241
+ assert ( e ) ;
242
+ assert . equal ( e . name , 'jsonld.UnknownFormat' ) ;
250
243
done ( ) ;
251
244
} ) ;
252
245
} ) ;
You can’t perform that action at this time.
0 commit comments