mirror of
https://github.com/withastro/astro.git
synced 2025-03-10 23:01:26 -05:00
chore: update tests
This commit is contained in:
parent
18978c70bd
commit
d835645adf
6 changed files with 25 additions and 41 deletions
|
@ -71,10 +71,8 @@ describe('astro:env secret variables', () => {
|
|||
it('fails if validateSecrets is enabled and secret is not set', async () => {
|
||||
fixture = await loadFixture({
|
||||
root: './fixtures/astro-env-server-secret/',
|
||||
experimental: {
|
||||
env: {
|
||||
validateSecrets: true,
|
||||
},
|
||||
env: {
|
||||
validateSecrets: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -2,12 +2,10 @@ import { defineConfig, envField } from 'astro/config';
|
|||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
experimental: {
|
||||
env: {
|
||||
schema: {
|
||||
FOO: envField.string({ context: "client", access: "public" }),
|
||||
BAR: envField.number({ context: "server", access: "public" }),
|
||||
}
|
||||
env: {
|
||||
schema: {
|
||||
FOO: envField.string({ context: "client", access: "public" }),
|
||||
BAR: envField.number({ context: "server", access: "public" }),
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -2,11 +2,9 @@ import { defineConfig, envField } from 'astro/config';
|
|||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
experimental: {
|
||||
env: {
|
||||
schema: {
|
||||
FOO: envField.string({ context: "server", access: "public", optional: true, default: "ABC" }),
|
||||
}
|
||||
env: {
|
||||
schema: {
|
||||
FOO: envField.string({ context: "server", access: "public", optional: true, default: "ABC" }),
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -2,11 +2,9 @@ import { defineConfig, envField } from 'astro/config';
|
|||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
experimental: {
|
||||
env: {
|
||||
schema: {
|
||||
KNOWN_SECRET: envField.number({ context: "server", access: "secret" })
|
||||
}
|
||||
env: {
|
||||
schema: {
|
||||
KNOWN_SECRET: envField.number({ context: "server", access: "secret" })
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -2,13 +2,11 @@ import { defineConfig, envField } from 'astro/config';
|
|||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
experimental: {
|
||||
env: {
|
||||
schema: {
|
||||
FOO: envField.string({ context: "client", access: "public", optional: true, default: "ABC" }),
|
||||
BAR: envField.string({ context: "client", access: "public", optional: true, default: "DEF" }),
|
||||
BAZ: envField.string({ context: "server", access: "public", optional: true, default: "GHI" }),
|
||||
}
|
||||
env: {
|
||||
schema: {
|
||||
FOO: envField.string({ context: "client", access: "public", optional: true, default: "ABC" }),
|
||||
BAR: envField.string({ context: "client", access: "public", optional: true, default: "DEF" }),
|
||||
BAZ: envField.string({ context: "server", access: "public", optional: true, default: "GHI" }),
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -358,10 +358,8 @@ describe('Config Validation', () => {
|
|||
assert.doesNotThrow(() =>
|
||||
validateConfig(
|
||||
{
|
||||
experimental: {
|
||||
env: {
|
||||
schema: undefined,
|
||||
},
|
||||
env: {
|
||||
schema: undefined,
|
||||
},
|
||||
},
|
||||
process.cwd(),
|
||||
|
@ -373,11 +371,9 @@ describe('Config Validation', () => {
|
|||
assert.doesNotThrow(() =>
|
||||
validateConfig(
|
||||
{
|
||||
experimental: {
|
||||
env: {
|
||||
schema: {
|
||||
ABC123: envField.string({ access: 'public', context: 'server' }),
|
||||
},
|
||||
env: {
|
||||
schema: {
|
||||
ABC123: envField.string({ access: 'public', context: 'server' }),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -389,11 +385,9 @@ describe('Config Validation', () => {
|
|||
it('Should not allow schema variables starting with a number', async () => {
|
||||
const configError = await validateConfig(
|
||||
{
|
||||
experimental: {
|
||||
env: {
|
||||
schema: {
|
||||
'123ABC': envField.string({ access: 'public', context: 'server' }),
|
||||
},
|
||||
env: {
|
||||
schema: {
|
||||
'123ABC': envField.string({ access: 'public', context: 'server' }),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue