Files
core/test/package-metadata.test.ts
T
chrnx f200045fd7
CI / dco (pull_request) Successful in 4s
CI / build (pull_request) Successful in 35s
chore: put a project address in the package metadata
author had no email and bugs had no address, so the only contact npm could show for a
published package was a GitHub issues URL. bugs.email is a field npm actually reads and
npm bugs surfaces, which makes it the right home for the catch-all.

No security address here on purpose: npm has no field for one, an invented key is read by
nothing, and the standard location is /.well-known/security.txt on the domain root, which
this repo does not serve.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-08-11 09:32:32 -05:00

43 lines
1.4 KiB
TypeScript

import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
interface PackageMetadata {
readonly repository?: {
readonly type?: string;
readonly url?: string;
};
readonly bugs?: {
readonly url?: string;
readonly email?: string;
};
readonly homepage?: string;
readonly author?: string;
}
const packageJson = JSON.parse(readFileSync(resolve(process.cwd(), 'package.json'), 'utf8')) as PackageMetadata;
describe('package publication metadata', () => {
it('links npm provenance to the public GitHub repository', () => {
expect(packageJson.repository).toEqual({
type: 'git',
url: 'git+https://github.com/Expressive-Tea/green-tea.git',
});
});
it('links npm consumers to support and documentation', () => {
expect(packageJson.bugs).toEqual({
url: 'https://github.com/Expressive-Tea/green-tea/issues',
email: 'projects@expressive-tea.io',
});
expect(packageJson.homepage).toBe('https://green-tea.expressive-tea.io/docs/');
});
// A published package whose only contact is a GitHub URL is unreachable to anyone without
// an account, so the address is pinned here rather than left to drift back out.
it('gives npm an address to show for the package', () => {
expect(packageJson.author).toBe('green-tea contributors <projects@expressive-tea.io>');
});
});