import { readFile } from 'node:fs/promises' import { resolve } from 'node:path' import { fileURLToPath } from 'node:url' import { expect, expectTypeOf, test } from 'vitest' import type { Context, NetlifyGlobal, ServerRegion, ServerSize } from './main.js' import * as main from './main.js' test('Exports types', () => { expectTypeOf().toExtend() expectTypeOf().toExtend() }) test('Server regions and sizes are the ones servers run on', () => { expectTypeOf().toEqualTypeOf<'cmh' | 'fra'>() expectTypeOf().toEqualTypeOf<'small' | 'medium' | 'large'>() }) test('Does not export runtime code', () => { expect(Object.keys(main)).toStrictEqual([]) }) test('Does not have dependencies', async () => { const packageJSONPath = resolve(fileURLToPath(import.meta.url), '../../package.json') const packageJSON = await readFile(packageJSONPath, 'utf8') const { dependencies = {} } = JSON.parse(packageJSON) expect(dependencies).toStrictEqual({}) })