landing-family-data-integrity.test.mjs
sha256:700fafdd1afa490919f9515d660ca6e75456bcd5bb67513abcd8757a634c01f6
docs: record AIP-b SD-21 land (KN #308)
Human
9 days ago
| 1 | import { describe, it } from 'node:test'; |
| 2 | import assert from 'node:assert'; |
| 3 | import { readFileSync } from 'node:fs'; |
| 4 | import { fileURLToPath } from 'node:url'; |
| 5 | import { dirname, join } from 'node:path'; |
| 6 | |
| 7 | const root = join(dirname(fileURLToPath(import.meta.url)), '..'); |
| 8 | const indexHtml = readFileSync(join(root, 'web', 'index.html'), 'utf8'); |
| 9 | |
| 10 | function hrefsMatching(re) { |
| 11 | const out = []; |
| 12 | const reGlobal = new RegExp(`href="([^"]+)"`, 'g'); |
| 13 | let m; |
| 14 | while ((m = reGlobal.exec(indexHtml))) { |
| 15 | if (re.test(m[1])) out.push(m[1]); |
| 16 | } |
| 17 | return out; |
| 18 | } |
| 19 | |
| 20 | describe('landing family URLs (data-integrity)', () => { |
| 21 | it('uses the canonical Ourware, scool.ing, and Overseer Kit hrefs', () => { |
| 22 | const ourware = hrefsMatching(/ourware\.org/); |
| 23 | assert.deepEqual([...new Set(ourware)], ['https://ourware.org']); |
| 24 | const scooling = hrefsMatching(/scool/); |
| 25 | assert.deepEqual([...new Set(scooling)], ['https://scool.ing']); |
| 26 | const kit = hrefsMatching(/overseer-kit/); |
| 27 | assert.deepEqual([...new Set(kit)], ['https://github.com/aaronrene/overseer-kit']); |
| 28 | }); |
| 29 | |
| 30 | it('uses the canonical Ourware social profile URLs', () => { |
| 31 | assert.deepEqual( |
| 32 | [...new Set(hrefsMatching(/facebook\.com/))], |
| 33 | ['https://www.facebook.com/profile.php?id=61593821631787'] |
| 34 | ); |
| 35 | assert.deepEqual( |
| 36 | [...new Set(hrefsMatching(/linkedin\.com/))], |
| 37 | ['https://www.linkedin.com/company/143378951'] |
| 38 | ); |
| 39 | assert.ok( |
| 40 | hrefsMatching(/youtube\.com\/channel\/UC85lDAayTYjkqPFOyDaORWA/).includes( |
| 41 | 'https://www.youtube.com/channel/UC85lDAayTYjkqPFOyDaORWA' |
| 42 | ) |
| 43 | ); |
| 44 | assert.ok(hrefsMatching(/^https:\/\/x\.com\/ourware$/).includes('https://x.com/ourware')); |
| 45 | }); |
| 46 | |
| 47 | it('does not point at Parentier, AgentCeption, school.ing, or http family hosts', () => { |
| 48 | assert.equal(hrefsMatching(/parentier/i).length, 0); |
| 49 | assert.equal(hrefsMatching(/agentception/i).length, 0); |
| 50 | assert.equal(hrefsMatching(/school\.ing/i).length, 0); |
| 51 | assert.equal(hrefsMatching(/^http:\/\/(ourware\.org|scool\.ing)/).length, 0); |
| 52 | }); |
| 53 | }); |
File History
1 commit
sha256:700fafdd1afa490919f9515d660ca6e75456bcd5bb67513abcd8757a634c01f6
docs: record AIP-b SD-21 land (KN #308)
Human
9 days ago