Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(check-test-ownership): cover crate aliases in ownership checks

Steven Enamakel0a19a2c8fa94
diff --git a/scripts/__tests__/check-test-ownership.test.mjs b/scripts/__tests__/check-test-ownership.test.mjs
index 277253d12f..85717b2b0f 100644
--- a/scripts/__tests__/check-test-ownership.test.mjs
+++ b/scripts/__tests__/check-test-ownership.test.mjs
@@ -61,6 +61,41 @@ test('rejects direct calls into TinyChannels provider internals', () => {
]);
});
+test('rejects direct calls through a crate alias', () => {
+ const source = [
+ 'use tinychannels as tc;',
+ 'tc::providers::email_channel::parse("message");',
+ ].join('\n');
+
+ assert.deepEqual(findOwnershipViolations(source, 'tests/email.rs'), [
+ {
+ line: 2,
+ path: 'tinychannels::providers::',
+ reason: 'TinyChannels provider behavior belongs in TinyChannels.',
+ },
+ ]);
+});
+
+test('rejects direct calls through an alias of a grouped implementation prefix', () => {
+ const source = [
+ 'use tinychannels::{providers as p};',
+ 'p::email_channel::parse("message");',
+ ].join('\n');
+
+ assert.deepEqual(findOwnershipViolations(source, 'tests/email.rs'), [
+ {
+ line: 1,
+ path: 'tinychannels::providers::',
+ reason: 'TinyChannels provider behavior belongs in TinyChannels.',
+ },
+ {
+ line: 2,
+ path: 'tinychannels::providers::',
+ reason: 'TinyChannels provider behavior belongs in TinyChannels.',
+ },
+ ]);
+});
+
test('expands nested grouped imports of TinyChannels provider internals', () => {
const source = `
use tinychannels::{providers::{email_channel::parse}};