test(06-00): add failing assertions for 7-backend registry (RED)
- EXPECTED_BACKENDS now includes onedrive, sftp, gcs, b2 (7 total) - Added describe blocks for OneDrive, SFTP, GCS, Backblaze B2 field assertions - 9 tests fail RED because registry.ts still has only 3 BackendType values
This commit is contained in:
@@ -147,3 +147,129 @@ describe('buildRcloneConf — error cases', () => {
|
||||
expect(() => buildRcloneConf(state)).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
// --- New backend fixtures (Phase 6) ---
|
||||
|
||||
const onedriveState: WizardState = {
|
||||
...INITIAL_STATE,
|
||||
remote: {
|
||||
name: 'my-onedrive',
|
||||
backendType: 'onedrive' as 'azureblob',
|
||||
params: {
|
||||
token: '{"access_token":"TOKEN","token_type":"Bearer","refresh_token":"REFRESH","expiry":"2026-01-01T00:00:00Z"}',
|
||||
drive_id: 'b!TESTDRIVEID',
|
||||
drive_type: 'business',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const sftpPasswordState: WizardState = {
|
||||
...INITIAL_STATE,
|
||||
remote: {
|
||||
name: 'my-sftp-pass',
|
||||
backendType: 'sftp' as 'azureblob',
|
||||
params: { host: 'sftp.example.com', user: 'admin', pass: 'secretpass', key_pem: '' },
|
||||
},
|
||||
};
|
||||
|
||||
const sftpKeyState: WizardState = {
|
||||
...INITIAL_STATE,
|
||||
remote: {
|
||||
name: 'my-sftp-key',
|
||||
backendType: 'sftp' as 'azureblob',
|
||||
params: { host: 'sftp.example.com', user: 'admin', pass: '', key_pem: '-----BEGIN RSA PRIVATE KEY-----\nMIIEo...\n-----END RSA PRIVATE KEY-----' },
|
||||
},
|
||||
};
|
||||
|
||||
const gcsState: WizardState = {
|
||||
...INITIAL_STATE,
|
||||
remote: {
|
||||
name: 'my-gcs',
|
||||
backendType: 'gcs' as 'azureblob',
|
||||
params: {
|
||||
project_number: '123456789',
|
||||
service_account_credentials: '{"type":"service_account","project_id":"my-project"}',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const b2State: WizardState = {
|
||||
...INITIAL_STATE,
|
||||
remote: {
|
||||
name: 'my-b2',
|
||||
backendType: 'b2' as 'azureblob',
|
||||
params: { account: 'APP_KEY_ID', key: 'APP_KEY_SECRET' },
|
||||
},
|
||||
};
|
||||
|
||||
describe('buildRcloneConf — onedrive', () => {
|
||||
it('contains type = onedrive', () => {
|
||||
expect(buildRcloneConf(onedriveState)).toContain('type = onedrive');
|
||||
});
|
||||
it('contains token value', () => {
|
||||
expect(buildRcloneConf(onedriveState)).toContain('token = ');
|
||||
});
|
||||
it('contains drive_id', () => {
|
||||
expect(buildRcloneConf(onedriveState)).toContain('drive_id = b!TESTDRIVEID');
|
||||
});
|
||||
it('contains drive_type = business', () => {
|
||||
expect(buildRcloneConf(onedriveState)).toContain('drive_type = business');
|
||||
});
|
||||
});
|
||||
|
||||
describe('buildRcloneConf — sftp (password auth)', () => {
|
||||
it('contains type = sftp', () => {
|
||||
expect(buildRcloneConf(sftpPasswordState)).toContain('type = sftp');
|
||||
});
|
||||
it('contains host', () => {
|
||||
expect(buildRcloneConf(sftpPasswordState)).toContain('host = sftp.example.com');
|
||||
});
|
||||
it('contains user', () => {
|
||||
expect(buildRcloneConf(sftpPasswordState)).toContain('user = admin');
|
||||
});
|
||||
it('contains pass', () => {
|
||||
expect(buildRcloneConf(sftpPasswordState)).toContain('pass = secretpass');
|
||||
});
|
||||
it('omits key_pem when empty', () => {
|
||||
expect(buildRcloneConf(sftpPasswordState)).not.toContain('key_pem');
|
||||
});
|
||||
});
|
||||
|
||||
describe('buildRcloneConf — sftp (key auth)', () => {
|
||||
it('contains type = sftp', () => {
|
||||
expect(buildRcloneConf(sftpKeyState)).toContain('type = sftp');
|
||||
});
|
||||
it('contains key_pem', () => {
|
||||
expect(buildRcloneConf(sftpKeyState)).toContain('key_pem = -----BEGIN RSA PRIVATE KEY-----');
|
||||
});
|
||||
it('omits pass when empty', () => {
|
||||
expect(buildRcloneConf(sftpKeyState)).not.toContain('pass =');
|
||||
});
|
||||
});
|
||||
|
||||
describe('buildRcloneConf — gcs', () => {
|
||||
it('contains type = google cloud storage (with spaces)', () => {
|
||||
expect(buildRcloneConf(gcsState)).toContain('type = google cloud storage');
|
||||
});
|
||||
it('does NOT contain type = gcs', () => {
|
||||
expect(buildRcloneConf(gcsState)).not.toContain('type = gcs');
|
||||
});
|
||||
it('contains project_number', () => {
|
||||
expect(buildRcloneConf(gcsState)).toContain('project_number = 123456789');
|
||||
});
|
||||
it('contains service_account_credentials', () => {
|
||||
expect(buildRcloneConf(gcsState)).toContain('service_account_credentials = ');
|
||||
});
|
||||
});
|
||||
|
||||
describe('buildRcloneConf — b2', () => {
|
||||
it('contains type = b2', () => {
|
||||
expect(buildRcloneConf(b2State)).toContain('type = b2');
|
||||
});
|
||||
it('contains account (applicationKeyId)', () => {
|
||||
expect(buildRcloneConf(b2State)).toContain('account = APP_KEY_ID');
|
||||
});
|
||||
it('contains key (application key secret)', () => {
|
||||
expect(buildRcloneConf(b2State)).toContain('key = APP_KEY_SECRET');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user