Browse Source
YAML tests should make it significantly less painful to test parsing of XML-based newsfeed formatsmaster
J. King
4 years ago
10 changed files with 872 additions and 938 deletions
@ -1,628 +0,0 @@ |
|||||
[ |
|
||||
{ |
|
||||
"description": "Minimal entry", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": "1" |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Invalid entry 1 (no ID)", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"title": "Example title" |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Invalid entry 2 (null ID)", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": null, |
|
||||
"title": "Example title" |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Invalid entry 3 (boolean ID)", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": true, |
|
||||
"title": "Example title" |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Invalid entry 4 (array ID)", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": ["1"], |
|
||||
"title": "Example title" |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Invalid entry 5 (object ID)", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": {"id": "1"}, |
|
||||
"title": "Example title" |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Invalid entry 6 (empty string ID)", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": "", |
|
||||
"title": "Example title" |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Integer ID", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": 1 |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Float ID", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": 3.0e-10 |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "0.0000000003" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Negative float ID", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": -3.0e-10 |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "-0.0000000003" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Simple float ID", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": 0.3 |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "0.3" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Bignum ID", |
|
||||
"input": "{\"version\": \"https://jsonfeed.org/version/1\",\"items\": [{\"id\": 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999}]}", |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry language", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"language": "en", |
|
||||
"items": [ |
|
||||
{ |
|
||||
"id": 1, |
|
||||
"language": "fr" |
|
||||
}, |
|
||||
{ |
|
||||
"id": "2" |
|
||||
} |
|
||||
] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"lang": "en", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"lang": "fr" |
|
||||
}, |
|
||||
{ |
|
||||
"id": "2", |
|
||||
"lang": "en" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry banner", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"banner_image": "http://example.com/banner" |
|
||||
} |
|
||||
] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"banner": "http://example.com/banner" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry dates", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"date_published": "2020-03-03T21:12:42Z", |
|
||||
"date_modified": "2020-03-03T21:12:42Z" |
|
||||
} |
|
||||
] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"dateCreated": "2020-03-03T21:12:42Z", |
|
||||
"dateModified": "2020-03-03T21:12:42Z" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry URLs", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"url": "http://example.com/", |
|
||||
"external_url": "http://example.org/" |
|
||||
} |
|
||||
] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"link": "http://example.com/", |
|
||||
"relatedLink": "http://example.org/" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry title", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"title": "Example title" |
|
||||
} |
|
||||
] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"title": "Example title" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry summary", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"summary": "Example summary" |
|
||||
} |
|
||||
] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"summary": "Example summary" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry content (plain only)", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"content_text": "Plain content" |
|
||||
} |
|
||||
] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"content": { |
|
||||
"plain": "Plain content" |
|
||||
} |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry content (HTML only)", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"content_html": "HTML content" |
|
||||
} |
|
||||
] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"content": { |
|
||||
"html": "HTML content" |
|
||||
} |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry content (mixed)", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"content_text": "Plain content", |
|
||||
"content_html": "HTML content" |
|
||||
} |
|
||||
] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"content": { |
|
||||
"plain": "Plain content", |
|
||||
"html": "HTML content" |
|
||||
} |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry categories", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"tags": ["this", "that", "the other thing", "", null, false, 1, 3.0, " "] |
|
||||
} |
|
||||
] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"categories": [ |
|
||||
{"name": "this"}, |
|
||||
{"name": "that"}, |
|
||||
{"name": "the other thing"}, |
|
||||
{"name": " "} |
|
||||
] |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry authors", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"authors": [ |
|
||||
{"name": "Jane Doe"}, |
|
||||
{"name": "John Doe"} |
|
||||
], |
|
||||
"items": [ |
|
||||
{ |
|
||||
"id": 1, |
|
||||
"author": {"name": "John Doe"}, |
|
||||
"authors": [{"name": "Jane Doe"}] |
|
||||
}, |
|
||||
{ |
|
||||
"id": 2, |
|
||||
"author": {"name": "John Doe"} |
|
||||
}, |
|
||||
{ |
|
||||
"id": 3, |
|
||||
"authors": [{"name": "Jane Doe"}] |
|
||||
}, |
|
||||
{ |
|
||||
"id": 4 |
|
||||
}, |
|
||||
{ |
|
||||
"id": 5, |
|
||||
"authors": [{"NAME": "Jane Doe"}] |
|
||||
} |
|
||||
] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"people": [ |
|
||||
{"name": "Jane Doe", "role": "author"}, |
|
||||
{"name": "John Doe", "role": "author"} |
|
||||
], |
|
||||
"entries": [ |
|
||||
{"id": "1", "people": [{"name": "Jane Doe", "role": "author"}]}, |
|
||||
{"id": "2", "people": [{"name": "John Doe", "role": "author"}]}, |
|
||||
{"id": "3", "people": [{"name": "Jane Doe", "role": "author"}]}, |
|
||||
{"id": "4", "people": [{"name": "Jane Doe", "role": "author"},{"name": "John Doe", "role": "author"}]}, |
|
||||
{"id": "5", "people": [{"name": "Jane Doe", "role": "author"},{"name": "John Doe", "role": "author"}]} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry image", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": "1", |
|
||||
"image": "http://example.com/image" |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"enclosures": [ |
|
||||
{ |
|
||||
"type": "image", |
|
||||
"url": "http://example.com/image", |
|
||||
"preferred": true |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry attachments", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": "1", |
|
||||
"attachments": [ |
|
||||
{ |
|
||||
"url": "http://example.com/image", |
|
||||
"mime_type": "image/svg+xml; charset=\"urf-8\"", |
|
||||
"title": "Logo", |
|
||||
"size_in_bytes": 2345 |
|
||||
}, |
|
||||
{ |
|
||||
"url": "http://example.com/graphic.png" |
|
||||
}, |
|
||||
{ |
|
||||
"url": "http://example.com/graphic.PNG" |
|
||||
}, |
|
||||
{ |
|
||||
"url": "data:text/plain,Hello%20World!", |
|
||||
"title": "Example text" |
|
||||
}, |
|
||||
{ |
|
||||
"url": "data:text/plain,File:example.jpg", |
|
||||
"title": "Sneaky URN" |
|
||||
}, |
|
||||
{ |
|
||||
"url": "http://example.com/talk", |
|
||||
"mime_type": "audio", |
|
||||
"duration_in_seconds": 72 |
|
||||
}, |
|
||||
{ |
|
||||
"title": "Invalid URL", |
|
||||
"url": "http://[.com/bogus" |
|
||||
}, |
|
||||
{ |
|
||||
"title": "No URL" |
|
||||
} |
|
||||
] |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"enclosures": [ |
|
||||
{ |
|
||||
"type": "image/svg+xml", |
|
||||
"url": "http://example.com/image", |
|
||||
"title": "Logo", |
|
||||
"size": 2345 |
|
||||
}, |
|
||||
{ |
|
||||
"type": "image/png", |
|
||||
"url": "http://example.com/graphic.png" |
|
||||
}, |
|
||||
{ |
|
||||
"type": "image/png", |
|
||||
"url": "http://example.com/graphic.PNG" |
|
||||
}, |
|
||||
{ |
|
||||
"url": "data:text/plain,Hello%20World!", |
|
||||
"title": "Example text" |
|
||||
}, |
|
||||
{ |
|
||||
"url": "data:text/plain,File:example.jpg", |
|
||||
"title": "Sneaky URN" |
|
||||
}, |
|
||||
{ |
|
||||
"url": "http://example.com/talk", |
|
||||
"type": "audio", |
|
||||
"duration": 72 |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Entry image and attachments", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"items": [{ |
|
||||
"id": "1", |
|
||||
"attachments": [ |
|
||||
{ |
|
||||
"url": "http://example.com/image", |
|
||||
"mime_type": "image/svg+xml; charset=\"urf-8\"", |
|
||||
"title": "Logo", |
|
||||
"size_in_bytes": 2345 |
|
||||
} |
|
||||
], |
|
||||
"image": "http://example.com/image" |
|
||||
}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"entries": [ |
|
||||
{ |
|
||||
"id": "1", |
|
||||
"enclosures": [ |
|
||||
{ |
|
||||
"type": "image", |
|
||||
"url": "http://example.com/image", |
|
||||
"preferred": true |
|
||||
}, |
|
||||
{ |
|
||||
"type": "image/svg+xml", |
|
||||
"url": "http://example.com/image", |
|
||||
"title": "Logo", |
|
||||
"size": 2345 |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
} |
|
||||
] |
|
@ -0,0 +1,547 @@ |
|||||
|
Minimal entry: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"id": "1" |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
|
||||
|
Invalid entry 1: # no ID |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"title": "Example title" |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
|
||||
|
Invalid entry 2: # null ID |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"title": "Example title", |
||||
|
"id": null |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
|
||||
|
Invalid entry 3: # boolean ID |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"title": "Example title", |
||||
|
"id": true |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
|
||||
|
Invalid entry 4: # array ID |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"title": "Example title", |
||||
|
"id": ["1"] |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
|
||||
|
Invalid entry 5: # object ID |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"title": "Example title", |
||||
|
"id": {"id": "1"} |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
|
||||
|
Invalid entry 6: # empty string ID |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"title": "Example title", |
||||
|
"id": "" |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
|
||||
|
Integer ID: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"id": 1 |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
|
||||
|
Float ID: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"id": 3.0e-10 |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '0.0000000003' |
||||
|
|
||||
|
Negative float ID: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"id": -3.0e-10 |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '-0.0000000003' |
||||
|
|
||||
|
Simple float ID: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"id": 0.3 |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '0.3' |
||||
|
|
||||
|
Bignum ID: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"id": 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999' |
||||
|
|
||||
|
Entry language: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"language": "en", |
||||
|
"items": [ |
||||
|
{ |
||||
|
"id": 1, |
||||
|
"language": "fr" |
||||
|
}, |
||||
|
{ |
||||
|
"id": "2" |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
lang: en |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
lang: fr |
||||
|
- id: '2' |
||||
|
lang: en |
||||
|
|
||||
|
Entry banner: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [ |
||||
|
{ |
||||
|
"id": "1", |
||||
|
"banner_image": "http://example.com/banner" |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
banner: 'http://example.com/banner' |
||||
|
|
||||
|
Entry dates: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [ |
||||
|
{ |
||||
|
"id": "1", |
||||
|
"date_published": "2020-03-03T21:12:42Z", |
||||
|
"date_modified": "2020-03-03T21:12:42Z" |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
dateCreated: '2020-03-03T21:12:42Z' |
||||
|
dateModified: '2020-03-03T21:12:42Z' |
||||
|
|
||||
|
Entry URLs: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [ |
||||
|
{ |
||||
|
"id": "1", |
||||
|
"url": "http://example.com/", |
||||
|
"external_url": "http://example.org/" |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
link: 'http://example.com/' |
||||
|
relatedLink: 'http://example.org/' |
||||
|
|
||||
|
Entry title: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [ |
||||
|
{ |
||||
|
"id": "1", |
||||
|
"title": "Example title" |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
title: 'Example title' |
||||
|
|
||||
|
Entry summary: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [ |
||||
|
{ |
||||
|
"id": "1", |
||||
|
"summary": "Example summary" |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
summary: 'Example summary' |
||||
|
|
||||
|
Entry content (plain only): |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [ |
||||
|
{ |
||||
|
"id": "1", |
||||
|
"content_text": "Plain content" |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
content: |
||||
|
plain: 'Plain content' |
||||
|
|
||||
|
Entry content (HTML only): |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [ |
||||
|
{ |
||||
|
"id": "1", |
||||
|
"content_html": "HTML content" |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
content: |
||||
|
html: 'HTML content' |
||||
|
|
||||
|
Entry content (mixed): |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [ |
||||
|
{ |
||||
|
"id": "1", |
||||
|
"content_text": "Plain content", |
||||
|
"content_html": "HTML content" |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
content: |
||||
|
plain: 'Plain content' |
||||
|
html: 'HTML content' |
||||
|
|
||||
|
Entry categories: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [ |
||||
|
{ |
||||
|
"id": "1", |
||||
|
"tags": ["this", "that", "the other thing", "", null, false, 1, 3.0, " "] |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
categories: |
||||
|
- name: this |
||||
|
- name: that |
||||
|
- name: 'the other thing' |
||||
|
- name: ' ' |
||||
|
|
||||
|
Entry authors: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"authors": [ |
||||
|
{"name": "Jane Doe"}, |
||||
|
{"name": "John Doe"} |
||||
|
], |
||||
|
"items": [ |
||||
|
{ |
||||
|
"id": 1, |
||||
|
"author": {"name": "John Doe"}, |
||||
|
"authors": [{"name": "Jane Doe"}] |
||||
|
}, |
||||
|
{ |
||||
|
"id": 2, |
||||
|
"author": {"name": "John Doe"} |
||||
|
}, |
||||
|
{ |
||||
|
"id": 3, |
||||
|
"authors": [{"name": "Jane Doe"}] |
||||
|
}, |
||||
|
{ |
||||
|
"id": 4 |
||||
|
}, |
||||
|
{ |
||||
|
"id": 5, |
||||
|
"authors": [{"NAME": "Jane Doe"}] |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
people: |
||||
|
- name: Jane Doe |
||||
|
role: author |
||||
|
- name: John Doe |
||||
|
role: author |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
people: |
||||
|
- name: Jane Doe |
||||
|
role: author |
||||
|
- id: '2' |
||||
|
people: |
||||
|
- name: John Doe |
||||
|
role: author |
||||
|
- id: '3' |
||||
|
people: |
||||
|
- name: Jane Doe |
||||
|
role: author |
||||
|
- id: '4' |
||||
|
people: |
||||
|
- name: Jane Doe |
||||
|
role: author |
||||
|
- name: John Doe |
||||
|
role: author |
||||
|
- id: '5' |
||||
|
people: |
||||
|
- name: Jane Doe |
||||
|
role: author |
||||
|
- name: John Doe |
||||
|
role: author |
||||
|
|
||||
|
Entry image: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"id": "1", |
||||
|
"image": "http://example.com/image" |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
enclosures: |
||||
|
- url: 'http://example.com/image' |
||||
|
type: image |
||||
|
preferred: true |
||||
|
|
||||
|
Entry attachments: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"id": "1", |
||||
|
"attachments": [ |
||||
|
{ |
||||
|
"url": "http://example.com/image", |
||||
|
"mime_type": "image/svg+xml; charset=\"urf-8\"", |
||||
|
"title": "Logo", |
||||
|
"size_in_bytes": 2345 |
||||
|
}, |
||||
|
{ |
||||
|
"url": "http://example.com/graphic.png" |
||||
|
}, |
||||
|
{ |
||||
|
"url": "http://example.com/graphic.PNG" |
||||
|
}, |
||||
|
{ |
||||
|
"url": "data:text/rtf,Hello%20World!", |
||||
|
"title": "Example text" |
||||
|
}, |
||||
|
{ |
||||
|
"url": "data:,Hello%20World!", |
||||
|
"title": "Example text" |
||||
|
}, |
||||
|
{ |
||||
|
"url": "urn:bogus:example.jpg", |
||||
|
"title": "Sneaky URN" |
||||
|
}, |
||||
|
{ |
||||
|
"url": "http://example.com/talk", |
||||
|
"mime_type": "audio", |
||||
|
"duration_in_seconds": 72 |
||||
|
}, |
||||
|
{ |
||||
|
"title": "Invalid URL", |
||||
|
"url": "http://[.com/bogus" |
||||
|
}, |
||||
|
{ |
||||
|
"title": "No URL" |
||||
|
} |
||||
|
] |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
enclosures: |
||||
|
- url: 'http://example.com/image' |
||||
|
type: 'image/svg+xml' |
||||
|
title: Logo |
||||
|
size: 2345 |
||||
|
- url: 'http://example.com/graphic.png' |
||||
|
type: 'image/png' |
||||
|
- url: 'http://example.com/graphic.PNG' |
||||
|
type: 'image/png' |
||||
|
- url: 'data:text/rtf,Hello%20World!' |
||||
|
type: 'text/rtf' |
||||
|
title: 'Example text' |
||||
|
- url: 'data:,Hello%20World!' |
||||
|
type: 'text/plain' |
||||
|
title: 'Example text' |
||||
|
- url: 'urn:bogus:example.jpg' |
||||
|
title: 'Sneaky URN' |
||||
|
- url: 'http://example.com/talk' |
||||
|
type: 'audio' |
||||
|
duration: 72 |
||||
|
|
||||
|
Entry image and attachments: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"items": [{ |
||||
|
"id": "1", |
||||
|
"attachments": [ |
||||
|
{ |
||||
|
"url": "http://example.com/logo", |
||||
|
"mime_type": "image/svg+xml; charset=\"urf-8\"", |
||||
|
"title": "Logo", |
||||
|
"size_in_bytes": 2345 |
||||
|
} |
||||
|
], |
||||
|
"image": "http://example.com/image" |
||||
|
}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
entries: |
||||
|
- id: '1' |
||||
|
enclosures: |
||||
|
- url: 'http://example.com/image' |
||||
|
type: image |
||||
|
preferred: true |
||||
|
- url: 'http://example.com/logo' |
||||
|
type: 'image/svg+xml' |
||||
|
title: Logo |
||||
|
size: 2345 |
@ -1,33 +0,0 @@ |
|||||
[ |
|
||||
{ |
|
||||
"description": "Content-Type mismatch", |
|
||||
"type": "text/html", |
|
||||
"input": {"version": "https://jsonfeed.org/version/1"}, |
|
||||
"exception": "notJSONType" |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Not valid JSON 1", |
|
||||
"input": "{", |
|
||||
"exception": "notJSON" |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Not valid JSON 2", |
|
||||
"input": "<rss><channel/></rss>", |
|
||||
"exception": "notJSON" |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Not a JSON feed 1", |
|
||||
"input": "{}", |
|
||||
"exception": "notJSONFeed" |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Not a JSON feed 2", |
|
||||
"input": {"version": "https://example.com/"}, |
|
||||
"exception": "notJSONFeed" |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Not a JSON feed 3", |
|
||||
"input": {"version": "https://jsonfeed.org/version/"}, |
|
||||
"exception": "notJSONFeed" |
|
||||
} |
|
||||
] |
|
@ -0,0 +1,24 @@ |
|||||
|
Content-Type mismatch: |
||||
|
type: text/html |
||||
|
input: '{"version": "https://jsonfeed.org/version/1"}' |
||||
|
exception: notJSONType |
||||
|
|
||||
|
Not valid JSON 1: |
||||
|
input: '{' |
||||
|
exception: notJSON |
||||
|
|
||||
|
Not valid JSON 2: |
||||
|
input: '<rss><channel/></rss>' |
||||
|
exception: notJSON |
||||
|
|
||||
|
Not a JSON feed 1: |
||||
|
input: '{}' |
||||
|
exception: notJSONFeed |
||||
|
|
||||
|
Not a JSON feed 2: |
||||
|
input: '{"version": "https://example.com/"}' |
||||
|
exception: notJSONFeed |
||||
|
|
||||
|
Not a JSON feed 3: |
||||
|
input: '{"version": "https://jsonfeed.org/version/"}' |
||||
|
exception: notJSONFeed |
@ -1,261 +0,0 @@ |
|||||
[ |
|
||||
{ |
|
||||
"description": "Minimal example 1", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1" |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Minimal example 2", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1.1" |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1.1" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Correct type of member", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"title": "Example title" |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"title": "Example title" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Incorrect type of member", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"title": 1001001 |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "URL -> ID equivalence", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"title": "Example title", |
|
||||
"feed_url": "http://example.com/" |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"title": "Example title", |
|
||||
"id": "http://example.com/", |
|
||||
"url": "http://example.com/" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Single author", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"author": {"name": "John Doe", "url": "http://example.org/", "avatar": "http://example.org/avatar"} |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"people": [ |
|
||||
{ |
|
||||
"role": "author", |
|
||||
"name": "John Doe", |
|
||||
"url": "http://example.org/", |
|
||||
"avatar": "http://example.org/avatar" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Multiple authors", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"authors": [ |
|
||||
{"name": "John Doe", "url": "http://example.org/", "avatar": "http://example.org/avatar"}, |
|
||||
{"name": "Jane Doe", "url": "http://example.net/", "avatar": "http://example.net/avatar"} |
|
||||
] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"people": [ |
|
||||
{ |
|
||||
"role": "author", |
|
||||
"name": "John Doe", |
|
||||
"url": "http://example.org/", |
|
||||
"avatar": "http://example.org/avatar" |
|
||||
}, |
|
||||
{ |
|
||||
"role": "author", |
|
||||
"name": "Jane Doe", |
|
||||
"url": "http://example.net/", |
|
||||
"avatar": "http://example.net/avatar" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Fallback author", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"authors": [ |
|
||||
{"name": "John Doe", "url": "http://example.org/", "avatar": "http://example.org/avatar"}, |
|
||||
{"name": "Jane Doe", "url": "http://example.net/", "avatar": "http://example.net/avatar"} |
|
||||
], |
|
||||
"author": {"name": "John Smith", "url": "http://example.biz/", "avatar": "http://example.biz/avatar"} |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"people": [ |
|
||||
{ |
|
||||
"role": "author", |
|
||||
"name": "John Doe", |
|
||||
"url": "http://example.org/", |
|
||||
"avatar": "http://example.org/avatar" |
|
||||
}, |
|
||||
{ |
|
||||
"role": "author", |
|
||||
"name": "Jane Doe", |
|
||||
"url": "http://example.net/", |
|
||||
"avatar": "http://example.net/avatar" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Empty author", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"author": {} |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Empty authors", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"authors": [{}] |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Empty authors with fallback", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"authors": [{}], |
|
||||
"author": {"name": "John Doe", "url": "http://example.org/", "avatar": "http://example.org/avatar"} |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"people": [ |
|
||||
{ |
|
||||
"role": "author", |
|
||||
"name": "John Doe", |
|
||||
"url": "http://example.org/", |
|
||||
"avatar": "http://example.org/avatar" |
|
||||
} |
|
||||
] |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Expired feed", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"expired": true |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"sched": { |
|
||||
"expired": true |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Not expired feed", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"expired": false |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"sched": { |
|
||||
"expired": false |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Invalidly expired feed", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"expired": 1 |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Basic example", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"language": "en", |
|
||||
"title": "Example title", |
|
||||
"feed_url": "http://example.com/", |
|
||||
"home_page_url": "http://example.net/", |
|
||||
"description": "Example description", |
|
||||
"user_comment": "Example comment", |
|
||||
"next_url": "http://example.com/next", |
|
||||
"icon": "http://example.com/image", |
|
||||
"favicon": "http://example.com/icon" |
|
||||
}, |
|
||||
"output": { |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"lang": "en", |
|
||||
"title": "Example title", |
|
||||
"id": "http://example.com/", |
|
||||
"url": "http://example.com/", |
|
||||
"link": "http://example.net/", |
|
||||
"summary": "Example description", |
|
||||
"icon": "http://example.com/icon", |
|
||||
"image": "http://example.com/image" |
|
||||
} |
|
||||
}, |
|
||||
{ |
|
||||
"description": "Relative URL resolution", |
|
||||
"doc_url": "http://example.com", |
|
||||
"input": { |
|
||||
"version": "https://jsonfeed.org/version/1", |
|
||||
"feed_url": "feed.json" |
|
||||
}, |
|
||||
"output": { |
|
||||
"meta": { |
|
||||
"url": "http://example.com" |
|
||||
}, |
|
||||
"format": "json", |
|
||||
"version": "1", |
|
||||
"id": "feed.json", |
|
||||
"url": ["feed.json", "http://example.com"] |
|
||||
} |
|
||||
} |
|
||||
] |
|
@ -0,0 +1,221 @@ |
|||||
|
Minimal example 1: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1" |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
|
||||
|
Minimal example 2: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1.1" |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1.1' |
||||
|
|
||||
|
Correct type of member: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"title": "Example title" |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
title: 'Example title' |
||||
|
|
||||
|
Incorrect type of member: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"title": 1001001 |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
|
||||
|
URL -> ID equivalence: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"feed_url": "http://example.com/" |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
id: 'http://example.com/' |
||||
|
url: 'http://example.com/' |
||||
|
|
||||
|
Single author: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"author": {"name": "John Doe", "url": "http://example.org/", "avatar": "http://example.org/avatar"} |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
people: |
||||
|
- role: author |
||||
|
name: John Doe |
||||
|
url: 'http://example.org/' |
||||
|
avatar: http://example.org/avatar |
||||
|
|
||||
|
Multiple authors: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"authors": [ |
||||
|
{"name": "John Doe", "url": "http://example.org/", "avatar": "http://example.org/avatar"}, |
||||
|
{"name": "Jane Doe", "url": "http://example.net/", "avatar": "http://example.net/avatar"} |
||||
|
] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
people: |
||||
|
- role: author |
||||
|
name: John Doe |
||||
|
url: 'http://example.org/' |
||||
|
avatar: http://example.org/avatar |
||||
|
- role: author |
||||
|
name: Jane Doe |
||||
|
url: 'http://example.net/' |
||||
|
avatar: http://example.net/avatar |
||||
|
|
||||
|
Fallback author: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"authors": [ |
||||
|
{"name": "John Doe", "url": "http://example.org/", "avatar": "http://example.org/avatar"}, |
||||
|
{"name": "Jane Doe", "url": "http://example.net/", "avatar": "http://example.net/avatar"} |
||||
|
], |
||||
|
"author": {"name": "John Smith", "url": "http://example.biz/", "avatar": "http://example.biz/avatar"} |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
people: |
||||
|
- role: author |
||||
|
name: John Doe |
||||
|
url: 'http://example.org/' |
||||
|
avatar: http://example.org/avatar |
||||
|
- role: author |
||||
|
name: Jane Doe |
||||
|
url: 'http://example.net/' |
||||
|
avatar: http://example.net/avatar |
||||
|
|
||||
|
Empty author: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"author": {} |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
|
||||
|
Empty authors: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"authors": [{}] |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
|
||||
|
Empty authors with fallback: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"authors": [{}], |
||||
|
"author": {"name": "John Doe", "url": "http://example.org/", "avatar": "http://example.org/avatar"} |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
people: |
||||
|
- role: author |
||||
|
name: John Doe |
||||
|
url: 'http://example.org/' |
||||
|
avatar: http://example.org/avatar |
||||
|
|
||||
|
Expired feed: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"expired": true |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
sched: |
||||
|
expired: true |
||||
|
|
||||
|
Not expired feed: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"expired": false |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
sched: |
||||
|
expired: false |
||||
|
|
||||
|
Improperly expired feed: # the 'expired' JSON Feed key is explicitly a boolean |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"expired": 1 |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
|
||||
|
Multiple elements: |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"language": "en", |
||||
|
"title": "Example title", |
||||
|
"feed_url": "http://example.com/", |
||||
|
"home_page_url": "http://example.net/", |
||||
|
"description": "Example description", |
||||
|
"user_comment": "Example comment", |
||||
|
"next_url": "http://example.com/next", |
||||
|
"icon": "http://example.com/image", |
||||
|
"favicon": "http://example.com/icon" |
||||
|
} |
||||
|
output: |
||||
|
format: json |
||||
|
version: '1' |
||||
|
lang: en |
||||
|
title: Example title |
||||
|
id: 'http://example.com/' |
||||
|
url: 'http://example.com/' |
||||
|
link: 'http://example.net/' |
||||
|
summary: Example description |
||||
|
icon: 'http://example.com/icon' |
||||
|
image: 'http://example.com/image' |
||||
|
|
||||
|
Relative URL resolution: |
||||
|
doc_url: 'http://example.com' |
||||
|
input: > |
||||
|
{ |
||||
|
"version": "https://jsonfeed.org/version/1", |
||||
|
"feed_url": "feed.json" |
||||
|
} |
||||
|
output: |
||||
|
meta: |
||||
|
url: 'http://example.com' |
||||
|
format: json |
||||
|
version: '1' |
||||
|
id: 'feed.json' |
||||
|
url: ['feed.json', 'http://example.com'] |
@ -1,5 +1,6 @@ |
|||||
{ |
{ |
||||
"require-dev": { |
"require-dev": { |
||||
"phpunit/phpunit": "^9.0" |
"phpunit/phpunit": "^9.0", |
||||
|
"symfony/yaml": "^5.0" |
||||
} |
} |
||||
} |
} |
||||
|
Loading…
Reference in new issue