mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 14:43:08 +03:00
Added tests for Admin API not returning lexical by default but including when requested
no issue - left `mobiledoc` as the only default format added in the post/page input serializers for now to minimize API/test churn during these early stages of lexical development - tested that the `lexical` field is not returned by default but can be requested via `?formats=lexical`
This commit is contained in:
parent
7ad1be2555
commit
9471384020
@ -1,5 +1,777 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Posts API Can browse 1: [body] 1`] = `
|
||||
Object {
|
||||
"meta": Object {
|
||||
"pagination": Object {
|
||||
"limit": 2,
|
||||
"next": 2,
|
||||
"page": 1,
|
||||
"pages": 7,
|
||||
"prev": null,
|
||||
"total": 13,
|
||||
},
|
||||
},
|
||||
"posts": Array [
|
||||
Object {
|
||||
"authors": Array [
|
||||
Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"comment_notifications": true,
|
||||
"cover_image": null,
|
||||
"created_at": "2022-09-13T12:17:08.000Z",
|
||||
"email": "jbloggs@example.com",
|
||||
"facebook": null,
|
||||
"free_member_signup_notification": true,
|
||||
"id": "1",
|
||||
"last_seen": "2022-09-13T12:17:09.000Z",
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Joe Bloggs",
|
||||
"paid_subscription_canceled_notification": false,
|
||||
"paid_subscription_started_notification": true,
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"roles": Array [
|
||||
Object {
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": "Blog Owner",
|
||||
"id": "632074c3082a107f3a4b0324",
|
||||
"name": "Owner",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
},
|
||||
],
|
||||
"slug": "joe-bloggs",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": "2022-09-13T12:17:09.000Z",
|
||||
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
|
||||
"website": null,
|
||||
},
|
||||
],
|
||||
"canonical_url": null,
|
||||
"codeinjection_foot": null,
|
||||
"codeinjection_head": null,
|
||||
"comment_id": "618ba1ffbe2896088840a6ed",
|
||||
"count": Object {
|
||||
"conversions": 0,
|
||||
"signups": 0,
|
||||
},
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"custom_excerpt": null,
|
||||
"custom_template": null,
|
||||
"email": null,
|
||||
"email_only": false,
|
||||
"email_segment": "all",
|
||||
"email_subject": null,
|
||||
"excerpt": "Welcome to my invisible post!",
|
||||
"feature_image": null,
|
||||
"feature_image_alt": null,
|
||||
"feature_image_caption": null,
|
||||
"featured": false,
|
||||
"frontmatter": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"mobiledoc": "{\\"version\\":\\"0.3.1\\",\\"markups\\":[],\\"atoms\\":[],\\"cards\\":[[\\"markdown\\",{\\"markdown\\":\\"<h1>Welcome to my invisible post!</h1>\\"}]],\\"sections\\":[[10,0]]}",
|
||||
"newsletter": null,
|
||||
"og_description": null,
|
||||
"og_image": null,
|
||||
"og_title": null,
|
||||
"primary_author": Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"comment_notifications": true,
|
||||
"cover_image": null,
|
||||
"created_at": "2022-09-13T12:17:08.000Z",
|
||||
"email": "jbloggs@example.com",
|
||||
"facebook": null,
|
||||
"free_member_signup_notification": true,
|
||||
"id": "1",
|
||||
"last_seen": "2022-09-13T12:17:09.000Z",
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Joe Bloggs",
|
||||
"paid_subscription_canceled_notification": false,
|
||||
"paid_subscription_started_notification": true,
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"roles": Array [
|
||||
Object {
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": "Blog Owner",
|
||||
"id": "632074c3082a107f3a4b0324",
|
||||
"name": "Owner",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
},
|
||||
],
|
||||
"slug": "joe-bloggs",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": "2022-09-13T12:17:09.000Z",
|
||||
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
|
||||
"website": null,
|
||||
},
|
||||
"primary_tag": null,
|
||||
"published_at": "2022-09-15T12:17:07.000Z",
|
||||
"slug": "scheduled-post",
|
||||
"status": "scheduled",
|
||||
"tags": Array [],
|
||||
"tiers": Array [
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": null,
|
||||
"id": "632074c3082a107f3a4b032b",
|
||||
"monthly_price_id": null,
|
||||
"name": "Default Product",
|
||||
"slug": "default-product",
|
||||
"trial_days": 0,
|
||||
"type": "paid",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": null,
|
||||
"id": "632074c3082a107f3a4b032c",
|
||||
"monthly_price_id": null,
|
||||
"name": "Free",
|
||||
"slug": "free",
|
||||
"trial_days": 0,
|
||||
"type": "free",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
],
|
||||
"title": "This is a scheduled post!!",
|
||||
"twitter_description": null,
|
||||
"twitter_image": null,
|
||||
"twitter_title": null,
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"url": "http://127.0.0.1:2369/p/fc6b0029-2565-4350-8265-78019c81301e/",
|
||||
"uuid": "fc6b0029-2565-4350-8265-78019c81301e",
|
||||
"visibility": "public",
|
||||
},
|
||||
Object {
|
||||
"authors": Array [
|
||||
Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"comment_notifications": true,
|
||||
"cover_image": null,
|
||||
"created_at": "2022-09-13T12:17:08.000Z",
|
||||
"email": "jbloggs@example.com",
|
||||
"facebook": null,
|
||||
"free_member_signup_notification": true,
|
||||
"id": "1",
|
||||
"last_seen": "2022-09-13T12:17:09.000Z",
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Joe Bloggs",
|
||||
"paid_subscription_canceled_notification": false,
|
||||
"paid_subscription_started_notification": true,
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"roles": Array [
|
||||
Object {
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": "Blog Owner",
|
||||
"id": "632074c3082a107f3a4b0324",
|
||||
"name": "Owner",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
},
|
||||
],
|
||||
"slug": "joe-bloggs",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": "2022-09-13T12:17:09.000Z",
|
||||
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
|
||||
"website": null,
|
||||
},
|
||||
],
|
||||
"canonical_url": null,
|
||||
"codeinjection_foot": null,
|
||||
"codeinjection_head": null,
|
||||
"comment_id": "618ba1ffbe2896088840a6e5",
|
||||
"count": Object {
|
||||
"conversions": 0,
|
||||
"signups": 0,
|
||||
},
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"custom_excerpt": null,
|
||||
"custom_template": null,
|
||||
"email": null,
|
||||
"email_only": false,
|
||||
"email_segment": "all",
|
||||
"email_subject": null,
|
||||
"excerpt": "HTML Ipsum Presents
|
||||
|
||||
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum o",
|
||||
"feature_image": null,
|
||||
"feature_image_alt": null,
|
||||
"feature_image_caption": null,
|
||||
"featured": false,
|
||||
"frontmatter": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"meta_description": "meta description for draft post",
|
||||
"meta_title": null,
|
||||
"mobiledoc": "{\\"version\\":\\"0.3.1\\",\\"markups\\":[],\\"atoms\\":[],\\"cards\\":[[\\"markdown\\",{\\"markdown\\":\\"<h1>HTML Ipsum Presents</h1><p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href=\\\\\\\\\\\\\\"#\\\\\\\\\\\\\\">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p><h2>Header Level 2</h2><ol><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ol><blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote><h3>Header Level 3</h3><ul><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ul><pre><code>#header h1 a{display: block;width: 300px;height: 80px;}</code></pre>\\"}]],\\"sections\\":[[10,0]]}",
|
||||
"newsletter": null,
|
||||
"og_description": null,
|
||||
"og_image": null,
|
||||
"og_title": null,
|
||||
"primary_author": Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"comment_notifications": true,
|
||||
"cover_image": null,
|
||||
"created_at": "2022-09-13T12:17:08.000Z",
|
||||
"email": "jbloggs@example.com",
|
||||
"facebook": null,
|
||||
"free_member_signup_notification": true,
|
||||
"id": "1",
|
||||
"last_seen": "2022-09-13T12:17:09.000Z",
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Joe Bloggs",
|
||||
"paid_subscription_canceled_notification": false,
|
||||
"paid_subscription_started_notification": true,
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"roles": Array [
|
||||
Object {
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": "Blog Owner",
|
||||
"id": "632074c3082a107f3a4b0324",
|
||||
"name": "Owner",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
},
|
||||
],
|
||||
"slug": "joe-bloggs",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": "2022-09-13T12:17:09.000Z",
|
||||
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
|
||||
"website": null,
|
||||
},
|
||||
"primary_tag": Object {
|
||||
"accent_color": null,
|
||||
"canonical_url": null,
|
||||
"codeinjection_foot": null,
|
||||
"codeinjection_head": null,
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": "description",
|
||||
"feature_image": null,
|
||||
"id": "6193c6d5e792de832cd08148",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "pollo",
|
||||
"og_description": null,
|
||||
"og_image": null,
|
||||
"og_title": null,
|
||||
"slug": "pollo",
|
||||
"twitter_description": null,
|
||||
"twitter_image": null,
|
||||
"twitter_title": null,
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"url": "http://127.0.0.1:2369/404/",
|
||||
"visibility": "public",
|
||||
},
|
||||
"published_at": "2022-09-13T12:17:07.000Z",
|
||||
"slug": "unfinished",
|
||||
"status": "draft",
|
||||
"tags": Array [
|
||||
Object {
|
||||
"accent_color": null,
|
||||
"canonical_url": null,
|
||||
"codeinjection_foot": null,
|
||||
"codeinjection_head": null,
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": "description",
|
||||
"feature_image": null,
|
||||
"id": "6193c6d5e792de832cd08148",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "pollo",
|
||||
"og_description": null,
|
||||
"og_image": null,
|
||||
"og_title": null,
|
||||
"slug": "pollo",
|
||||
"twitter_description": null,
|
||||
"twitter_image": null,
|
||||
"twitter_title": null,
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"url": "http://127.0.0.1:2369/404/",
|
||||
"visibility": "public",
|
||||
},
|
||||
],
|
||||
"tiers": Array [
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": null,
|
||||
"id": "632074c3082a107f3a4b032b",
|
||||
"monthly_price_id": null,
|
||||
"name": "Default Product",
|
||||
"slug": "default-product",
|
||||
"trial_days": 0,
|
||||
"type": "paid",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": null,
|
||||
"id": "632074c3082a107f3a4b032c",
|
||||
"monthly_price_id": null,
|
||||
"name": "Free",
|
||||
"slug": "free",
|
||||
"trial_days": 0,
|
||||
"type": "free",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
],
|
||||
"title": "Not finished yet",
|
||||
"twitter_description": null,
|
||||
"twitter_image": null,
|
||||
"twitter_title": null,
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"url": "http://127.0.0.1:2369/p/d52c42ae-2755-455c-80ec-70b2ec55c903/",
|
||||
"uuid": "d52c42ae-2755-455c-80ec-70b2ec55c903",
|
||||
"visibility": "public",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Posts API Can browse 2: [headers] 1`] = `
|
||||
Object {
|
||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
||||
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
||||
"content-length": "9894",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Posts API Can browse with formats 1: [body] 1`] = `
|
||||
Object {
|
||||
"meta": Object {
|
||||
"pagination": Object {
|
||||
"limit": 2,
|
||||
"next": 2,
|
||||
"page": 1,
|
||||
"pages": 7,
|
||||
"prev": null,
|
||||
"total": 13,
|
||||
},
|
||||
},
|
||||
"posts": Array [
|
||||
Object {
|
||||
"authors": Array [
|
||||
Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"comment_notifications": true,
|
||||
"cover_image": null,
|
||||
"created_at": "2022-09-13T12:17:08.000Z",
|
||||
"email": "jbloggs@example.com",
|
||||
"facebook": null,
|
||||
"free_member_signup_notification": true,
|
||||
"id": "1",
|
||||
"last_seen": "2022-09-13T12:17:09.000Z",
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Joe Bloggs",
|
||||
"paid_subscription_canceled_notification": false,
|
||||
"paid_subscription_started_notification": true,
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"roles": Array [
|
||||
Object {
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": "Blog Owner",
|
||||
"id": "632074c3082a107f3a4b0324",
|
||||
"name": "Owner",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
},
|
||||
],
|
||||
"slug": "joe-bloggs",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": "2022-09-13T12:17:09.000Z",
|
||||
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
|
||||
"website": null,
|
||||
},
|
||||
],
|
||||
"canonical_url": null,
|
||||
"codeinjection_foot": null,
|
||||
"codeinjection_head": null,
|
||||
"comment_id": "618ba1ffbe2896088840a6ed",
|
||||
"count": Object {
|
||||
"conversions": 0,
|
||||
"signups": 0,
|
||||
},
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"custom_excerpt": null,
|
||||
"custom_template": null,
|
||||
"email": null,
|
||||
"email_only": false,
|
||||
"email_segment": "all",
|
||||
"email_subject": null,
|
||||
"excerpt": "Welcome to my invisible post!",
|
||||
"feature_image": null,
|
||||
"feature_image_alt": null,
|
||||
"feature_image_caption": null,
|
||||
"featured": false,
|
||||
"frontmatter": null,
|
||||
"html": "<!--kg-card-begin: markdown--><h1>Welcome to my invisible post!</h1><!--kg-card-end: markdown-->",
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"lexical": null,
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"mobiledoc": "{\\"version\\":\\"0.3.1\\",\\"markups\\":[],\\"atoms\\":[],\\"cards\\":[[\\"markdown\\",{\\"markdown\\":\\"<h1>Welcome to my invisible post!</h1>\\"}]],\\"sections\\":[[10,0]]}",
|
||||
"newsletter": null,
|
||||
"og_description": null,
|
||||
"og_image": null,
|
||||
"og_title": null,
|
||||
"plaintext": "Welcome to my invisible post!",
|
||||
"primary_author": Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"comment_notifications": true,
|
||||
"cover_image": null,
|
||||
"created_at": "2022-09-13T12:17:08.000Z",
|
||||
"email": "jbloggs@example.com",
|
||||
"facebook": null,
|
||||
"free_member_signup_notification": true,
|
||||
"id": "1",
|
||||
"last_seen": "2022-09-13T12:17:09.000Z",
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Joe Bloggs",
|
||||
"paid_subscription_canceled_notification": false,
|
||||
"paid_subscription_started_notification": true,
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"roles": Array [
|
||||
Object {
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": "Blog Owner",
|
||||
"id": "632074c3082a107f3a4b0324",
|
||||
"name": "Owner",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
},
|
||||
],
|
||||
"slug": "joe-bloggs",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": "2022-09-13T12:17:09.000Z",
|
||||
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
|
||||
"website": null,
|
||||
},
|
||||
"primary_tag": null,
|
||||
"published_at": "2022-09-15T12:17:07.000Z",
|
||||
"reading_time": 0,
|
||||
"slug": "scheduled-post",
|
||||
"status": "scheduled",
|
||||
"tags": Array [],
|
||||
"tiers": Array [
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": null,
|
||||
"id": "632074c3082a107f3a4b032b",
|
||||
"monthly_price_id": null,
|
||||
"name": "Default Product",
|
||||
"slug": "default-product",
|
||||
"trial_days": 0,
|
||||
"type": "paid",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": null,
|
||||
"id": "632074c3082a107f3a4b032c",
|
||||
"monthly_price_id": null,
|
||||
"name": "Free",
|
||||
"slug": "free",
|
||||
"trial_days": 0,
|
||||
"type": "free",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
],
|
||||
"title": "This is a scheduled post!!",
|
||||
"twitter_description": null,
|
||||
"twitter_image": null,
|
||||
"twitter_title": null,
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"url": "http://127.0.0.1:2369/p/fc6b0029-2565-4350-8265-78019c81301e/",
|
||||
"uuid": "fc6b0029-2565-4350-8265-78019c81301e",
|
||||
"visibility": "public",
|
||||
},
|
||||
Object {
|
||||
"authors": Array [
|
||||
Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"comment_notifications": true,
|
||||
"cover_image": null,
|
||||
"created_at": "2022-09-13T12:17:08.000Z",
|
||||
"email": "jbloggs@example.com",
|
||||
"facebook": null,
|
||||
"free_member_signup_notification": true,
|
||||
"id": "1",
|
||||
"last_seen": "2022-09-13T12:17:09.000Z",
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Joe Bloggs",
|
||||
"paid_subscription_canceled_notification": false,
|
||||
"paid_subscription_started_notification": true,
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"roles": Array [
|
||||
Object {
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": "Blog Owner",
|
||||
"id": "632074c3082a107f3a4b0324",
|
||||
"name": "Owner",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
},
|
||||
],
|
||||
"slug": "joe-bloggs",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": "2022-09-13T12:17:09.000Z",
|
||||
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
|
||||
"website": null,
|
||||
},
|
||||
],
|
||||
"canonical_url": null,
|
||||
"codeinjection_foot": null,
|
||||
"codeinjection_head": null,
|
||||
"comment_id": "618ba1ffbe2896088840a6e5",
|
||||
"count": Object {
|
||||
"conversions": 0,
|
||||
"signups": 0,
|
||||
},
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"custom_excerpt": null,
|
||||
"custom_template": null,
|
||||
"email": null,
|
||||
"email_only": false,
|
||||
"email_segment": "all",
|
||||
"email_subject": null,
|
||||
"excerpt": "HTML Ipsum Presents
|
||||
|
||||
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum o",
|
||||
"feature_image": null,
|
||||
"feature_image_alt": null,
|
||||
"feature_image_caption": null,
|
||||
"featured": false,
|
||||
"frontmatter": null,
|
||||
"html": "<!--kg-card-begin: markdown--><h1>HTML Ipsum Presents</h1><p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href=\\\\\\"#\\\\\\">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p><h2>Header Level 2</h2><ol><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ol><blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote><h3>Header Level 3</h3><ul><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ul><pre><code>#header h1 a{display: block;width: 300px;height: 80px;}</code></pre><!--kg-card-end: markdown-->",
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"lexical": null,
|
||||
"meta_description": "meta description for draft post",
|
||||
"meta_title": null,
|
||||
"mobiledoc": "{\\"version\\":\\"0.3.1\\",\\"markups\\":[],\\"atoms\\":[],\\"cards\\":[[\\"markdown\\",{\\"markdown\\":\\"<h1>HTML Ipsum Presents</h1><p><strong>Pellentesque habitant morbi tristique</strong> senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. <em>Aenean ultricies mi vitae est.</em> Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, <code>commodo vitae</code>, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. <a href=\\\\\\\\\\\\\\"#\\\\\\\\\\\\\\">Donec non enim</a> in turpis pulvinar facilisis. Ut felis.</p><h2>Header Level 2</h2><ol><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ol><blockquote><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.</p></blockquote><h3>Header Level 3</h3><ul><li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li><li>Aliquam tincidunt mauris eu risus.</li></ul><pre><code>#header h1 a{display: block;width: 300px;height: 80px;}</code></pre>\\"}]],\\"sections\\":[[10,0]]}",
|
||||
"newsletter": null,
|
||||
"og_description": null,
|
||||
"og_image": null,
|
||||
"og_title": null,
|
||||
"plaintext": "HTML Ipsum Presents
|
||||
|
||||
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.
|
||||
|
||||
|
||||
Header Level 2
|
||||
|
||||
1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
|
||||
2. Aliquam tincidunt mauris eu risus.
|
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.
|
||||
|
||||
|
||||
Header Level 3
|
||||
|
||||
* Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
|
||||
* Aliquam tincidunt mauris eu risus.
|
||||
|
||||
#header h1 a{display: block;width: 300px;height: 80px;}",
|
||||
"primary_author": Object {
|
||||
"accessibility": null,
|
||||
"bio": "bio",
|
||||
"comment_notifications": true,
|
||||
"cover_image": null,
|
||||
"created_at": "2022-09-13T12:17:08.000Z",
|
||||
"email": "jbloggs@example.com",
|
||||
"facebook": null,
|
||||
"free_member_signup_notification": true,
|
||||
"id": "1",
|
||||
"last_seen": "2022-09-13T12:17:09.000Z",
|
||||
"location": "location",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "Joe Bloggs",
|
||||
"paid_subscription_canceled_notification": false,
|
||||
"paid_subscription_started_notification": true,
|
||||
"profile_image": "https://example.com/super_photo.jpg",
|
||||
"roles": Array [
|
||||
Object {
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": "Blog Owner",
|
||||
"id": "632074c3082a107f3a4b0324",
|
||||
"name": "Owner",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
},
|
||||
],
|
||||
"slug": "joe-bloggs",
|
||||
"status": "active",
|
||||
"tour": null,
|
||||
"twitter": null,
|
||||
"updated_at": "2022-09-13T12:17:09.000Z",
|
||||
"url": "http://127.0.0.1:2369/author/joe-bloggs/",
|
||||
"website": null,
|
||||
},
|
||||
"primary_tag": Object {
|
||||
"accent_color": null,
|
||||
"canonical_url": null,
|
||||
"codeinjection_foot": null,
|
||||
"codeinjection_head": null,
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": "description",
|
||||
"feature_image": null,
|
||||
"id": "6193c6d5e792de832cd08148",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "pollo",
|
||||
"og_description": null,
|
||||
"og_image": null,
|
||||
"og_title": null,
|
||||
"slug": "pollo",
|
||||
"twitter_description": null,
|
||||
"twitter_image": null,
|
||||
"twitter_title": null,
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"url": "http://127.0.0.1:2369/404/",
|
||||
"visibility": "public",
|
||||
},
|
||||
"published_at": "2022-09-13T12:17:07.000Z",
|
||||
"reading_time": 1,
|
||||
"slug": "unfinished",
|
||||
"status": "draft",
|
||||
"tags": Array [
|
||||
Object {
|
||||
"accent_color": null,
|
||||
"canonical_url": null,
|
||||
"codeinjection_foot": null,
|
||||
"codeinjection_head": null,
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": "description",
|
||||
"feature_image": null,
|
||||
"id": "6193c6d5e792de832cd08148",
|
||||
"meta_description": null,
|
||||
"meta_title": null,
|
||||
"name": "pollo",
|
||||
"og_description": null,
|
||||
"og_image": null,
|
||||
"og_title": null,
|
||||
"slug": "pollo",
|
||||
"twitter_description": null,
|
||||
"twitter_image": null,
|
||||
"twitter_title": null,
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"url": "http://127.0.0.1:2369/404/",
|
||||
"visibility": "public",
|
||||
},
|
||||
],
|
||||
"tiers": Array [
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": null,
|
||||
"id": "632074c3082a107f3a4b032b",
|
||||
"monthly_price_id": null,
|
||||
"name": "Default Product",
|
||||
"slug": "default-product",
|
||||
"trial_days": 0,
|
||||
"type": "paid",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
Object {
|
||||
"active": true,
|
||||
"created_at": "2022-09-13T12:17:07.000Z",
|
||||
"description": null,
|
||||
"id": "632074c3082a107f3a4b032c",
|
||||
"monthly_price_id": null,
|
||||
"name": "Free",
|
||||
"slug": "free",
|
||||
"trial_days": 0,
|
||||
"type": "free",
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price_id": null,
|
||||
},
|
||||
],
|
||||
"title": "Not finished yet",
|
||||
"twitter_description": null,
|
||||
"twitter_image": null,
|
||||
"twitter_title": null,
|
||||
"updated_at": "2022-09-13T12:17:07.000Z",
|
||||
"url": "http://127.0.0.1:2369/p/d52c42ae-2755-455c-80ec-70b2ec55c903/",
|
||||
"uuid": "d52c42ae-2755-455c-80ec-70b2ec55c903",
|
||||
"visibility": "public",
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Posts API Can browse with formats 2: [headers] 1`] = `
|
||||
Object {
|
||||
"access-control-allow-origin": "http://127.0.0.1:2369",
|
||||
"cache-control": "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
|
||||
"content-length": "12760",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"etag": StringMatching /\\(\\?:W\\\\/\\)\\?"\\(\\?:\\[ !#-\\\\x7E\\\\x80-\\\\xFF\\]\\*\\|\\\\r\\\\n\\[\\\\t \\]\\|\\\\\\\\\\.\\)\\*"/,
|
||||
"vary": "Origin, Accept-Encoding",
|
||||
"x-powered-by": "Express",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Posts API Cannot delete a non-existent posts 1: [body] 1`] = `
|
||||
Object {
|
||||
"errors": Array [
|
||||
|
@ -39,6 +39,24 @@ describe('Pages API', function () {
|
||||
jsonResponse.pages[1].url.should.eql(`${config.get('url')}/contribute/`);
|
||||
});
|
||||
|
||||
it('Can retrieve pages with lexical format', async function () {
|
||||
const res = await request.get(localUtils.API.getApiQuery('pages/?formats=lexical'))
|
||||
.set('Origin', config.get('url'))
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200);
|
||||
|
||||
should.not.exist(res.headers['x-cache-invalidate']);
|
||||
const jsonResponse = res.body;
|
||||
should.exist(jsonResponse.pages);
|
||||
localUtils.API.checkResponse(jsonResponse, 'pages');
|
||||
jsonResponse.pages.should.have.length(6);
|
||||
|
||||
const additionalProperties = ['lexical'];
|
||||
const missingProperties = ['mobiledoc'];
|
||||
localUtils.API.checkResponse(jsonResponse.pages[0], 'page', additionalProperties, missingProperties);
|
||||
});
|
||||
|
||||
it('Can add a page', async function () {
|
||||
const page = {
|
||||
title: 'My Page',
|
||||
|
@ -1,6 +1,6 @@
|
||||
const assert = require('assert');
|
||||
const {agentProvider, fixtureManager, mockManager, matchers} = require('../../utils/e2e-framework');
|
||||
const {anyEtag, anyErrorId} = matchers;
|
||||
const {anyEtag, anyErrorId, anyObjectId} = matchers;
|
||||
|
||||
describe('Posts API', function () {
|
||||
let agent;
|
||||
@ -15,6 +15,32 @@ describe('Posts API', function () {
|
||||
mockManager.restore();
|
||||
});
|
||||
|
||||
it('Can browse', async function () {
|
||||
const res = await agent.get('posts/?limit=2')
|
||||
.expectStatus(200)
|
||||
.matchHeaderSnapshot({
|
||||
etag: anyEtag
|
||||
})
|
||||
.matchBodySnapshot({
|
||||
posts: new Array(2).fill({
|
||||
id: anyObjectId
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('Can browse with formats', async function () {
|
||||
const res = await agent.get('posts/?formats=mobiledoc,lexical,html,plaintext&limit=2')
|
||||
.expectStatus(200)
|
||||
.matchHeaderSnapshot({
|
||||
etag: anyEtag
|
||||
})
|
||||
.matchBodySnapshot({
|
||||
posts: new Array(2).fill({
|
||||
id: anyObjectId
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
describe('Delete', function () {
|
||||
it('Can destroy a post', async function () {
|
||||
await agent
|
||||
|
Loading…
Reference in New Issue
Block a user