diff options
Diffstat (limited to 'packages/db/test/local-prod.test.js')
-rw-r--r-- | packages/db/test/local-prod.test.js | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/packages/db/test/local-prod.test.js b/packages/db/test/local-prod.test.js index 150c2383f..7090fe6bf 100644 --- a/packages/db/test/local-prod.test.js +++ b/packages/db/test/local-prod.test.js @@ -1,6 +1,7 @@ import { expect } from 'chai'; import testAdapter from '../../astro/test/test-adapter.js'; import { loadFixture } from '../../astro/test/test-utils.js'; +import { fileURLToPath } from 'url'; describe('astro:db local database', () => { let fixture; @@ -12,7 +13,7 @@ describe('astro:db local database', () => { }); }); - describe('build (not remote) with DATABASE_FILE env', () => { + describe('build (not remote) with DATABASE_FILE env (file URL)', () => { const prodDbPath = new URL('./fixtures/basics/dist/astro.db', import.meta.url).toString(); before(async () => { process.env.ASTRO_DATABASE_FILE = prodDbPath; @@ -31,6 +32,25 @@ describe('astro:db local database', () => { }); }); + describe('build (not remote) with DATABASE_FILE env (file path)', () => { + const prodDbPath = fileURLToPath(new URL('./fixtures/basics/dist/astro.db', import.meta.url)); + before(async () => { + process.env.ASTRO_DATABASE_FILE = prodDbPath; + await fixture.build(); + }); + + after(async () => { + delete process.env.ASTRO_DATABASE_FILE; + }); + + it('Can render page', async () => { + const app = await fixture.loadTestAdapterApp(); + const request = new Request('http://example.com/'); + const response = await app.render(request); + expect(response.status).to.equal(200); + }); + }); + describe('build (not remote)', () => { it('should throw during the build for server output', async () => { delete process.env.ASTRO_DATABASE_FILE; |