test(05-00): update registry.test.ts to use .fields access for TECH-03 shape
- Update BACKEND_REGISTRY[backend].length → .fields.length - Update iteration to use BACKEND_REGISTRY[backend].fields - Update field lookups (.find/.map) to go through .fields - Add new test: each backend has displayName and description metadata (RED)
This commit is contained in:
@@ -12,13 +12,13 @@ describe('Backend Schema Registry', () => {
|
||||
|
||||
it('each backend has at least one field definition', () => {
|
||||
for (const backend of EXPECTED_BACKENDS) {
|
||||
expect(BACKEND_REGISTRY[backend].length).toBeGreaterThan(0);
|
||||
expect(BACKEND_REGISTRY[backend].fields.length).toBeGreaterThan(0);
|
||||
}
|
||||
});
|
||||
|
||||
it('each FieldDef has a non-empty key (snake_case, no camelCase)', () => {
|
||||
for (const backend of EXPECTED_BACKENDS) {
|
||||
for (const field of BACKEND_REGISTRY[backend]) {
|
||||
for (const field of BACKEND_REGISTRY[backend].fields) {
|
||||
expect(field.key).toBeTruthy();
|
||||
// Reject camelCase — rclone keys are snake_case or lowercase
|
||||
expect(field.key).not.toMatch(/[A-Z]/);
|
||||
@@ -28,28 +28,35 @@ describe('Backend Schema Registry', () => {
|
||||
|
||||
it('each FieldDef has a non-empty label', () => {
|
||||
for (const backend of EXPECTED_BACKENDS) {
|
||||
for (const field of BACKEND_REGISTRY[backend]) {
|
||||
for (const field of BACKEND_REGISTRY[backend].fields) {
|
||||
expect(field.label).toBeTruthy();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('Azure Blob has account field (required)', () => {
|
||||
const accountField = BACKEND_REGISTRY.azureblob.find(f => f.key === 'account');
|
||||
const accountField = BACKEND_REGISTRY.azureblob.fields.find(f => f.key === 'account');
|
||||
expect(accountField).toBeDefined();
|
||||
expect(accountField!.required).toBe(true);
|
||||
});
|
||||
|
||||
it('S3 has access_key_id, secret_access_key, and region fields', () => {
|
||||
const keys = BACKEND_REGISTRY.s3.map(f => f.key);
|
||||
const keys = BACKEND_REGISTRY.s3.fields.map(f => f.key);
|
||||
expect(keys).toContain('access_key_id');
|
||||
expect(keys).toContain('secret_access_key');
|
||||
expect(keys).toContain('region');
|
||||
});
|
||||
|
||||
it('S3-compatible has endpoint field (required)', () => {
|
||||
const endpointField = BACKEND_REGISTRY['s3-compatible'].find(f => f.key === 'endpoint');
|
||||
const endpointField = BACKEND_REGISTRY['s3-compatible'].fields.find(f => f.key === 'endpoint');
|
||||
expect(endpointField).toBeDefined();
|
||||
expect(endpointField!.required).toBe(true);
|
||||
});
|
||||
|
||||
it('each backend entry has displayName and description metadata', () => {
|
||||
for (const backend of EXPECTED_BACKENDS) {
|
||||
expect(BACKEND_REGISTRY[backend].displayName).toBeTruthy();
|
||||
expect(BACKEND_REGISTRY[backend].description).toBeTruthy();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user