mirror of
https://github.com/KuekHaoYang/KVideo.git
synced 2026-08-13 07:43:43 +08:00
Keep every post-59948b5 change inside verification/. The verifier owns its npm working directory and sanitized Docker context, so no release metadata or root Docker configuration is modified.
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import {
|
|
isCloudflareDeployment,
|
|
isVercelDeployment,
|
|
shouldEnableVercelAnalytics,
|
|
} from '../../../lib/config/deployment';
|
|
|
|
// GH-ISSUE: 105,127,200,202; GH-PR: 59,232,233,234
|
|
|
|
test('self-hosted deployments do not enable Vercel Analytics', () => {
|
|
const env = {};
|
|
|
|
assert.equal(isVercelDeployment(env), false);
|
|
assert.equal(isCloudflareDeployment(env), false);
|
|
assert.equal(shouldEnableVercelAnalytics(env), false);
|
|
});
|
|
|
|
test('Vercel deployments enable Vercel Analytics', () => {
|
|
assert.equal(shouldEnableVercelAnalytics({ VERCEL: '1' }), true);
|
|
assert.equal(shouldEnableVercelAnalytics({ VERCEL_ENV: 'production' }), true);
|
|
});
|
|
|
|
test('Cloudflare deployments do not enable Vercel Analytics', () => {
|
|
assert.equal(shouldEnableVercelAnalytics({ CF_PAGES: '1' }), false);
|
|
assert.equal(shouldEnableVercelAnalytics({ CF_PAGES_URL: 'https://kvideo.pages.dev' }), false);
|
|
});
|
|
|
|
test('Cloudflare wins when adapter environments expose Vercel-like variables', () => {
|
|
const env = {
|
|
VERCEL: '1',
|
|
VERCEL_ENV: 'production',
|
|
CF_PAGES: '1',
|
|
};
|
|
|
|
assert.equal(isVercelDeployment(env), true);
|
|
assert.equal(isCloudflareDeployment(env), true);
|
|
assert.equal(shouldEnableVercelAnalytics(env), false);
|
|
});
|