Skip to content

Commit

Permalink
chore: test
Browse files Browse the repository at this point in the history
  • Loading branch information
danez committed Apr 12, 2023
1 parent 3b01f65 commit eb23376
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions tests/integration/100.command.dev.test.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { platform } from 'os'

// Handlers are meant to be async outside tests
const path = require('path')

Expand Down Expand Up @@ -1020,6 +1022,10 @@ test('should have only allowed environment variables set', async (t) => {
handler: () => new Response(`${JSON.stringify(Deno.env.toObject())}`),
name: 'env',
})
.withContentFile({
content: 'FROM_ENV="YAS"',
path: '.env',
})

await builder.buildAsync()

Expand All @@ -1040,16 +1046,26 @@ test('should have only allowed environment variables set', async (t) => {
)
const envKeys = Object.keys(response)

t.false(envKeys.includes('DENO_DEPLOYMENT_ID'))
// t.true(envKeys.includes('DENO_DEPLOYMENT_ID'))
// t.is(response.DENO_DEPLOYMENT_ID, 'xxx=')
// On macOS there is always `__CF_USER_TEXT_ENCODING`
t.is(envKeys.length, platform() === 'darwin' ? 6 : 5)

console.log(envKeys)

t.true(envKeys.includes('PATH'))

t.true(envKeys.includes('DENO_REGION'))
t.is(response.DENO_REGION, 'local')

t.true(envKeys.includes('NETLIFY_DEV'))
t.is(response.NETLIFY_DEV, 'true')

t.true(envKeys.includes('SECRET_ENV'))
t.is(response.SECRET_ENV, 'true')

t.true(envKeys.includes('FROM_ENV'))
t.is(response.FROM_ENV, 'YAS')

t.false(envKeys.includes('DENO_DEPLOYMENT_ID'))
t.false(envKeys.includes('NODE_ENV'))
t.false(envKeys.includes('DEPLOY_URL'))
t.false(envKeys.includes('URL'))
Expand Down

0 comments on commit eb23376

Please sign in to comment.