Skip to content
← Public packages

@kentcdodds/codemod-runner

Run codemods over your own saved packages: scan, dry-run with real publish checks and diffs, apply, and revert.

src/contract.test.ts

27 lines · 639 B · TypeScript
import assert from 'node:assert/strict'
import test from 'node:test'
import { validateCodemodRef } from './contract.ts'

test('validateCodemodRef requires an owner-scoped matching package specifier', () => {
	const codemod = {
		kodyId: 'my-codemod',
		specifier: 'kody:@alice/my-codemod',
	}
	assert.equal(validateCodemodRef(codemod), codemod)
	assert.throws(
		() =>
			validateCodemodRef({
				kodyId: 'my-codemod',
				specifier: 'kody:@alice/other-codemod',
			}),
		/kody:@owner\/kodyId/,
	)
	assert.throws(
		() =>
			validateCodemodRef({
				kodyId: 'my-codemod',
				specifier: 'my-codemod',
			}),
		/kody:@owner\/kodyId/,
	)
})