Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
const res = await createPost('hello')
expect([200, 302]).toContain(res.status)

const doc = db.raw.prepare("SELECT title, slug, is_published, q_blog_difficulty d, q_blog_author a FROM documents WHERE type_id='blog_post' AND slug='hello'").get()

Check failure on line 90 in packages/core/src/__tests__/routes/admin-content-docbacked.integration.test.ts

View workflow job for this annotation

GitHub Actions / test

src/__tests__/routes/admin-content-docbacked.integration.test.ts > admin-content Option B (document-backed blog_post) — integration > create routes to the documents table (not content)

SqliteError: no such column: q_blog_difficulty ❯ Database.prepare ../../node_modules/better-sqlite3/lib/methods/wrappers.js:5:21 ❯ src/__tests__/routes/admin-content-docbacked.integration.test.ts:90:24 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Serialized Error: { code: 'SQLITE_ERROR' }
expect(doc).toBeTruthy()
expect(doc.is_published).toBe(1)
expect(doc.d).toBe('advanced')
Expand Down Expand Up @@ -120,7 +120,8 @@
body: form({ _method: 'PUT', collection_id: COLL, title: 'Post updateme v2', slug: 'updateme', content: '<p>v2</p>', author: 'Ada', difficulty: 'beginner', status: 'published' }),
})
expect([200, 302]).toContain(res.status)
// A new version exists and exactly one published row, now at v2.
// versioning=true on blog_post: publish() keeps the old published row as history.
// Two rows exist — v1 (old published, now a historical version) and v2 (new current draft + published).
expect(db.raw.prepare("SELECT COUNT(*) n FROM documents WHERE root_id=?").get(rootId).n).toBe(2)
expect(db.raw.prepare("SELECT COUNT(*) n FROM documents WHERE root_id=? AND is_published=1").get(rootId).n).toBe(1)
expect(db.raw.prepare("SELECT version_number v FROM documents WHERE root_id=? AND is_published=1").get(rootId).v).toBe(2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ describe('api-content-crud → documents (decommission step)', () => {
const created = (await (await app.request('/api/content', json('POST', { collectionId: 'blog_post', title: 'V1', slug: 'v', status: 'published', data: {} }))).json()).data
const res = await app.request(`/api/content/${created.id}`, json('PUT', { data: { body: 'v2' }, status: 'published' }))
expect(res.status).toBe(200)
// versioning=true on blog_post: publish() keeps the old published row as history.
// Two rows exist — v1 (old published, now a historical version) and v2 (new current draft + published).
expect(db.raw.prepare('SELECT COUNT(*) n FROM documents WHERE root_id=?').get(created.id).n).toBe(2)
expect(db.raw.prepare('SELECT version_number v FROM documents WHERE root_id=? AND is_published=1').get(created.id).v).toBe(2)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@
},
"iconEmoji": "📸",
"is_core": true,
"defaultActive": true,
"defaultSettings": {}
}
Loading