Fix UI tests by ensuring test DB is seeded

pull/28/head
Pete Bacon Darwin 2023-01-06 16:02:26 +00:00
rodzic 29abf1e510
commit 036db19ede
3 zmienionych plików z 4 dodań i 4 usunięć

Wyświetl plik

@ -22,7 +22,7 @@ async function main() {
define: ['jest:{}'],
}
const workerPath = resolve(__dirname, "./worker.ts");
const worker = await unstable_dev(workerPath, options, { disableExperimentalWarning: true })
const worker = await unstable_dev(workerPath, {...options, experimental: {disableExperimentalWarning: true }})
await worker.fetch()
await worker.stop()
}

Wyświetl plik

@ -5,13 +5,13 @@ describe('Posts timeline page', () => {
const response = await fetch('http://0.0.0.0:6868/')
expect(response.status).toBe(200)
const body = await response.text()
expect(body).toContain('It is that time of the year. The Wreath of Khan.')
expect(body).toContain("I'll be House Speaker")
})
it('should display a list of statuses for the explore page', async () => {
const response = await fetch('http://0.0.0.0:6868/explore/')
expect(response.status).toBe(200)
const body = await response.text()
expect(body).toContain('It is that time of the year. The Wreath of Khan.')
expect(body).toContain("I'll be House Speaker")
})
})

Wyświetl plik

@ -34,7 +34,7 @@
"database:migrate": "yarn d1 migrations apply DATABASE",
"database:create-mock": "rm -f .wrangler/state/d1/DATABASE.sqlite3 && yarn database:migrate --local && node ./frontend/mock-db/run.mjs",
"dev": "yarn build && yarn database:migrate --local && yarn pages dev frontend/dist --d1 DATABASE --persist --compatibility-date=2022-12-20",
"test:ui": "yarn build && concurrently --success command-1 --kill-others \"yarn pages dev frontend/dist --d1 DATABASE --persist --port 6868 --compatibility-date=2022-12-20 || true\" \"yarn --cwd frontend jest --verbose\"",
"test:ui": "yarn build && yarn database:create-mock && concurrently --success command-1 --kill-others \"yarn pages dev frontend/dist --d1 DATABASE --persist --port 6868 --compatibility-date=2022-12-20 || true\" \"yarn --cwd frontend jest --verbose\"",
"deploy:init": "yarn pages project create wildebeest && yarn d1 create wildebeest",
"deploy": "yarn build && yarn database:migrate && yarn pages publish frontend/dist --project-name=wildebeest"
},