opencode-pilot 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,86 +0,0 @@
1
- /**
2
- * Tests for config.js - unified YAML configuration
3
- */
4
-
5
- import { test, describe, beforeEach, afterEach } from 'node:test';
6
- import assert from 'node:assert';
7
- import { mkdtempSync, writeFileSync, mkdirSync, rmSync } from 'fs';
8
- import { join } from 'path';
9
- import { tmpdir } from 'os';
10
-
11
- // We'll test the module by creating temp config files
12
-
13
- describe('config.js', () => {
14
- let tempDir;
15
- let configPath;
16
- let templatesDir;
17
-
18
- beforeEach(() => {
19
- tempDir = mkdtempSync(join(tmpdir(), 'opencode-pilot-test-'));
20
- configPath = join(tempDir, 'config.yaml');
21
- templatesDir = join(tempDir, 'templates');
22
- mkdirSync(templatesDir);
23
- });
24
-
25
- afterEach(() => {
26
- rmSync(tempDir, { recursive: true, force: true });
27
- });
28
-
29
- describe('loadConfig', () => {
30
- test('reads notifications from config.yaml', async () => {
31
- writeFileSync(configPath, `
32
- notifications:
33
- topic: test-topic
34
- server: https://custom.ntfy.sh
35
- idle_delay_ms: 600000
36
- `);
37
-
38
- const { loadConfig } = await import('../../plugin/config.js');
39
- const config = loadConfig(configPath);
40
-
41
- assert.strictEqual(config.topic, 'test-topic');
42
- assert.strictEqual(config.server, 'https://custom.ntfy.sh');
43
- assert.strictEqual(config.idleDelayMs, 600000);
44
- });
45
-
46
- test('returns defaults when config file missing', async () => {
47
- const { loadConfig } = await import('../../plugin/config.js');
48
- const config = loadConfig('/nonexistent/path/config.yaml');
49
-
50
- assert.strictEqual(config.server, 'https://ntfy.sh');
51
- assert.strictEqual(config.idleDelayMs, 300000);
52
- });
53
-
54
- test('handles all config options', async () => {
55
- writeFileSync(configPath, `
56
- notifications:
57
- topic: my-topic
58
- server: https://ntfy.example.com
59
- token: tk_xxx
60
- idle_delay_ms: 600000
61
- idle_notify: false
62
- error_notify: false
63
- error_debounce_ms: 120000
64
- retry_notify_first: false
65
- retry_notify_after: 5
66
- debug: true
67
- debug_path: /custom/debug.log
68
- `);
69
-
70
- const { loadConfig } = await import('../../plugin/config.js');
71
- const config = loadConfig(configPath);
72
-
73
- assert.strictEqual(config.topic, 'my-topic');
74
- assert.strictEqual(config.server, 'https://ntfy.example.com');
75
- assert.strictEqual(config.authToken, 'tk_xxx');
76
- assert.strictEqual(config.idleDelayMs, 600000);
77
- assert.strictEqual(config.idleNotify, false);
78
- assert.strictEqual(config.errorNotify, false);
79
- assert.strictEqual(config.errorDebounceMs, 120000);
80
- assert.strictEqual(config.retryNotifyFirst, false);
81
- assert.strictEqual(config.retryNotifyAfter, 5);
82
- assert.strictEqual(config.debug, true);
83
- assert.strictEqual(config.debugPath, '/custom/debug.log');
84
- });
85
- });
86
- });