Loading files
3c0f87db3This file is pinned to the selected release. Download the original to open it in your design tool.
Files from this revision, including CAD and LFS contents. Git history is not included.
Or in GitHub Desktop, choose File → Clone repository → URL and paste this address.
Public repositories can be cloned without signing in. For pushing, use your ThingAtlas username and a Git access token as the password.
git lfs install git clone https://thingatlas.com/git/-unclaimed/stack-chan-374381865.git
Includes Git history, branches, and Git LFS files. Clones the repository’s default branch, regardless of the version shown here.
import assert from 'node:assert/strict'
import { test } from 'node:test'
import { validateCloudflareConfig } from './validate-cloudflare-config.mjs'
const validConfig = {
CLOUDFLARE_ACCOUNT_ID: '0123456789abcdef0123456789abcdef',
CLOUDFLARE_API_TOKEN: 'secret',
CLOUDFLARE_PAGES_PROJECT: 'stack-chan-pr-preview',
}
test('accepts the required Cloudflare Pages configuration', () => {
assert.doesNotThrow(() => validateCloudflareConfig(validConfig))
})
test('rejects missing and malformed Cloudflare Pages configuration', () => {
assert.throws(() => validateCloudflareConfig({}), /CLOUDFLARE_ACCOUNT_ID is not configured/)
assert.throws(
() => validateCloudflareConfig({ ...validConfig, CLOUDFLARE_ACCOUNT_ID: 'not-an-id' }),
/32-character hexadecimal ID/
)
assert.throws(
() => validateCloudflareConfig({ ...validConfig, CLOUDFLARE_PAGES_PROJECT: 'Invalid/project' }),
/unsupported characters/
)
})
3c0f87db3This file is pinned to the selected release. Download the original to open it in your design tool.