diff options
author | 2025-06-05 16:18:32 +0200 | |
---|---|---|
committer | 2025-06-05 16:18:32 +0200 | |
commit | 61e779486fffd77eed4b95eec0ab5fcf106dd2d5 (patch) | |
tree | 85518de42eea4004e4c891676bce52836de06461 /packages/db/test | |
parent | 0947a69192ad6820970902c7c951fb0cf31fcf4b (diff) | |
download | astro-feat/remove-studio.tar.gz astro-feat/remove-studio.tar.zst astro-feat/remove-studio.zip |
feat: remove studiofeat/remove-studio
Diffstat (limited to 'packages/db/test')
-rw-r--r-- | packages/db/test/basics.test.js | 4 | ||||
-rw-r--r-- | packages/db/test/ssr-no-apptoken.test.js | 2 | ||||
-rw-r--r-- | packages/db/test/test-utils.js | 8 | ||||
-rw-r--r-- | packages/db/test/unit/remote-info.test.js | 50 |
4 files changed, 10 insertions, 54 deletions
diff --git a/packages/db/test/basics.test.js b/packages/db/test/basics.test.js index 8d6167447..02f5bce37 100644 --- a/packages/db/test/basics.test.js +++ b/packages/db/test/basics.test.js @@ -181,13 +181,13 @@ describe('astro:db', () => { before(async () => { clearEnvironment(); - process.env.ASTRO_STUDIO_APP_TOKEN = 'some token'; + process.env.ASTRO_DB_APP_TOKEN = 'some token'; remoteDbServer = await setupRemoteDbServer(fixture.config); await fixture.build(); }); after(async () => { - process.env.ASTRO_STUDIO_APP_TOKEN = ''; + process.env.ASTRO_DB_APP_TOKEN = ''; await remoteDbServer?.stop(); }); diff --git a/packages/db/test/ssr-no-apptoken.test.js b/packages/db/test/ssr-no-apptoken.test.js index c570306e5..a78d7bf58 100644 --- a/packages/db/test/ssr-no-apptoken.test.js +++ b/packages/db/test/ssr-no-apptoken.test.js @@ -17,7 +17,7 @@ describe('missing app token', () => { remoteDbServer = await setupRemoteDbServer(fixture.config); await fixture.build(); // Ensure there's no token at runtime - delete process.env.ASTRO_STUDIO_APP_TOKEN; + delete process.env.ASTRO_DB_APP_TOKEN; }); after(async () => { diff --git a/packages/db/test/test-utils.js b/packages/db/test/test-utils.js index b608d75b8..b2a351a47 100644 --- a/packages/db/test/test-utils.js +++ b/packages/db/test/test-utils.js @@ -21,7 +21,7 @@ let portIncrementer = 8030; */ export async function setupRemoteDbServer(astroConfig) { const port = portIncrementer++; - process.env.ASTRO_STUDIO_REMOTE_DB_URL = `http://localhost:${port}`; + process.env.ASTRO_DB_REMOTE_DB_URL = `http://localhost:${port}`; process.env.ASTRO_INTERNAL_TEST_REMOTE = true; const server = createRemoteDbServer().listen(port); @@ -50,7 +50,7 @@ export async function setupRemoteDbServer(astroConfig) { return { server, async stop() { - delete process.env.ASTRO_STUDIO_REMOTE_DB_URL; + delete process.env.ASTRO_DB_REMOTE_DB_URL; delete process.env.ASTRO_INTERNAL_TEST_REMOTE; return new Promise((resolve, reject) => { server.close((err) => { @@ -83,12 +83,12 @@ export async function initializeRemoteDb(astroConfig) { } /** - * Clears the environment variables related to Astro DB and Astro Studio. + * Clears the environment variables related to Astro DB. */ export function clearEnvironment() { const keys = Array.from(Object.keys(process.env)); for (const key of keys) { - if (key.startsWith('ASTRO_DB_') || key.startsWith('ASTRO_STUDIO_')) { + if (key.startsWith('ASTRO_DB_')) { delete process.env[key]; } } diff --git a/packages/db/test/unit/remote-info.test.js b/packages/db/test/unit/remote-info.test.js index 2c58f28b7..c72d59b4f 100644 --- a/packages/db/test/unit/remote-info.test.js +++ b/packages/db/test/unit/remote-info.test.js @@ -8,6 +8,7 @@ describe('RemoteDatabaseInfo', () => { clearEnvironment(); }); + // TODO: what should be the default url for libsql? test('default remote info', () => { const dbInfo = getRemoteDatabaseInfo(); @@ -17,16 +18,6 @@ describe('RemoteDatabaseInfo', () => { }); }); - test('configured Astro Studio remote', () => { - process.env.ASTRO_STUDIO_REMOTE_DB_URL = 'https://studio.astro.build'; - const dbInfo = getRemoteDatabaseInfo(); - - assert.deepEqual(dbInfo, { - type: 'studio', - url: 'https://studio.astro.build', - }); - }); - test('configured libSQL remote', () => { process.env.ASTRO_DB_REMOTE_URL = 'libsql://libsql.self.hosted'; const dbInfo = getRemoteDatabaseInfo(); @@ -36,24 +27,12 @@ describe('RemoteDatabaseInfo', () => { url: 'libsql://libsql.self.hosted', }); }); - - test('configured both libSQL and Studio remote', () => { - process.env.ASTRO_DB_REMOTE_URL = 'libsql://libsql.self.hosted'; - process.env.ASTRO_STUDIO_REMOTE_DB_URL = 'https://studio.astro.build'; - const dbInfo = getRemoteDatabaseInfo(); - - assert.deepEqual(dbInfo, { - type: 'studio', - url: 'https://studio.astro.build', - }); - }); }); describe('RemoteManagedToken', () => { // Avoid conflicts with other tests beforeEach(() => { clearEnvironment(); - process.env.ASTRO_STUDIO_APP_TOKEN = 'studio token'; process.env.ASTRO_DB_APP_TOKEN = 'db token'; }); after(() => { @@ -68,20 +47,7 @@ describe('RemoteManagedToken', () => { test('token for default remote', async () => { const { token } = await getManagedRemoteToken(); - assert.equal(token, 'studio token'); - }); - - test('given token for configured Astro Studio remote', async () => { - process.env.ASTRO_STUDIO_REMOTE_DB_URL = 'https://studio.astro.build'; - const { token } = await getManagedRemoteToken('given token'); - assert.equal(token, 'given token'); - }); - - test('token for configured Astro Studio remote', async () => { - process.env.ASTRO_STUDIO_REMOTE_DB_URL = 'https://studio.astro.build'; - const { token } = await getManagedRemoteToken(); - - assert.equal(token, 'studio token'); + assert.equal(token, 'db token'); }); test('given token for configured libSQL remote', async () => { @@ -97,18 +63,8 @@ describe('RemoteManagedToken', () => { assert.equal(token, 'db token'); }); - test('token for given Astro Studio remote', async () => { - process.env.ASTRO_DB_REMOTE_URL = 'libsql://libsql.self.hosted'; - const { token } = await getManagedRemoteToken(undefined, { - type: 'studio', - url: 'https://studio.astro.build', - }); - - assert.equal(token, 'studio token'); - }); - test('token for given libSQL remote', async () => { - process.env.ASTRO_STUDIO_REMOTE_URL = 'libsql://libsql.self.hosted'; + process.env.ASTRO_DB_REMOTE_URL = 'libsql://libsql.self.hosted'; const { token } = await getManagedRemoteToken(undefined, { type: 'libsql', url: 'libsql://libsql.self.hosted', |