import-url-importer.test.mjs
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠ breaking
1 day ago
| 1 | /** |
| 2 | * URL importer integration (network: example.com). |
| 3 | * Skips when example.com is not resolvable (offline/sandbox) so `npm test` is reliable without network. |
| 4 | * CI and normal dev (with DNS) run the test. |
| 5 | */ |
| 6 | import { describe, it } from 'node:test'; |
| 7 | import assert from 'node:assert/strict'; |
| 8 | import fs from 'fs'; |
| 9 | import os from 'os'; |
| 10 | import path from 'path'; |
| 11 | import dns from 'node:dns/promises'; |
| 12 | import { importUrl } from '../lib/importers/url.mjs'; |
| 13 | |
| 14 | let importUrlNetworkSkipReason; |
| 15 | try { |
| 16 | await dns.lookup('example.com'); |
| 17 | importUrlNetworkSkipReason = false; |
| 18 | } catch (e) { |
| 19 | const msg = e && e.message ? String(e.message) : String(e); |
| 20 | importUrlNetworkSkipReason = |
| 21 | 'example.com DNS not available (' + msg + '); set network access or use CI to run this integration test.'; |
| 22 | } |
| 23 | |
| 24 | describe('importUrl', () => { |
| 25 | it('dryRun fetches https://example.com with auto mode', { skip: importUrlNetworkSkipReason }, async () => { |
| 26 | const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'kn-url-dry-')); |
| 27 | try { |
| 28 | const result = await importUrl('https://example.com/', { |
| 29 | vaultPath: dir, |
| 30 | outputBase: 'inbox', |
| 31 | project: null, |
| 32 | tags: [], |
| 33 | dryRun: true, |
| 34 | urlMode: 'auto', |
| 35 | }); |
| 36 | assert.equal(result.count, 1); |
| 37 | assert.ok(result.imported[0].path.includes('imports/url/')); |
| 38 | assert.ok(result.imported[0].source_id); |
| 39 | } finally { |
| 40 | fs.rmSync(dir, { recursive: true, force: true }); |
| 41 | } |
| 42 | }); |
| 43 | }); |
File History
2 commits
sha256:65ccb454656ea5acdea0a10e559b78bcde1eb6ff753ecc2911bc99d1c3d7cadd
feat(calendar): enforce agent context tiers in retrieval AP…
Human
minor
⚠
1 day ago
sha256:9103f98c89257ed2b01c237cea895dabb3e85ea337dccb1161c175e4422355b6
docs: accept Calendar Events v0 spec with Phase 0 security …
Human
1 day ago