- Replace single-file 8441-line HTML with Vue 3 SPA - Pinia stores: auth, oils, recipes, diary, ui - Composables: useApi, useDialog, useSmartPaste, useOilTranslation - 6 shared components: RecipeCard, RecipeDetailOverlay, TagPicker, etc. - 9 page views: RecipeSearch, RecipeManager, Inventory, OilReference, etc. - 14 Cypress E2E test specs (113 tests), all passing - Multi-stage Dockerfile (Node build + Python runtime) - Demo video generation scripts (TTS + subtitles + screen recording) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
65 lines
1.9 KiB
JavaScript
65 lines
1.9 KiB
JavaScript
describe('API Health Check', () => {
|
|
it('GET /api/version returns version', () => {
|
|
cy.request('/api/version').then(res => {
|
|
expect(res.status).to.eq(200)
|
|
expect(res.body).to.have.property('version')
|
|
})
|
|
})
|
|
|
|
it('GET /api/oils returns oil list', () => {
|
|
cy.request('/api/oils').then(res => {
|
|
expect(res.status).to.eq(200)
|
|
expect(res.body).to.be.an('array')
|
|
expect(res.body.length).to.be.gte(1)
|
|
const oil = res.body[0]
|
|
expect(oil).to.have.property('name')
|
|
expect(oil).to.have.property('bottle_price')
|
|
expect(oil).to.have.property('drop_count')
|
|
})
|
|
})
|
|
|
|
it('GET /api/recipes returns recipe list', () => {
|
|
cy.request('/api/recipes').then(res => {
|
|
expect(res.status).to.eq(200)
|
|
expect(res.body).to.be.an('array')
|
|
if (res.body.length > 0) {
|
|
const recipe = res.body[0]
|
|
expect(recipe).to.have.property('name')
|
|
expect(recipe).to.have.property('ingredients')
|
|
}
|
|
})
|
|
})
|
|
|
|
it('GET /api/tags returns tags array', () => {
|
|
cy.request('/api/tags').then(res => {
|
|
expect(res.status).to.eq(200)
|
|
expect(res.body).to.be.an('array')
|
|
})
|
|
})
|
|
|
|
it('GET /api/me returns anonymous user without auth', () => {
|
|
cy.request('/api/me').then(res => {
|
|
expect(res.status).to.eq(200)
|
|
expect(res.body.username).to.eq('anonymous')
|
|
expect(res.body.role).to.eq('viewer')
|
|
})
|
|
})
|
|
|
|
it('GET /api/me returns authenticated user with valid token', () => {
|
|
// Use the admin token from env or skip
|
|
const token = Cypress.env('ADMIN_TOKEN')
|
|
if (!token) {
|
|
cy.log('ADMIN_TOKEN not set, skipping auth test')
|
|
return
|
|
}
|
|
cy.request({
|
|
url: '/api/me',
|
|
headers: { Authorization: `Bearer ${token}` }
|
|
}).then(res => {
|
|
expect(res.status).to.eq(200)
|
|
expect(res.body.id).to.not.be.null
|
|
expect(res.body.username).to.not.eq('anonymous')
|
|
})
|
|
})
|
|
})
|