import test from 'node:test'; import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; const read = path => readFileSync(new URL('../' + path, import.meta.url), 'utf8'); const {careers, families} = JSON.parse(read('assets/career-directory.json')); function verify(path, exactTitle) { const body = read(path.slice(1) + 'index.html'); assert.match(body, /
/, path); assert.match(body, /

[^<]+<\/h1>/, path); if (exactTitle) assert.ok(body.includes('

' + exactTitle + '

'), path); assert.match(body, /

[^<]{35,}<\/p>/, path); assert.match(body, /

(?:Formal training|Scope) and next steps<\/h2>/, path); const steps = body.match(/
    (.*?)<\/ol>/s)?.[1]; assert.ok(steps, path); assert.equal([...steps.matchAll(/
  1. [^<]+<\/h3>

    [^<]{10,}<\/p>/g)].length, 4, path); assert.match(steps, /href="https:\/\//, path); assert.match(body, /not a credential or a job offer/, path); assert.match(body, /href="glimmer:\/\/community\/atom-[a-z0-9-]+"/, path); assert.doesNotMatch(body, / { assert.equal(careers.length, 848); for (const [code] of careers) verify('/careers/' + code + '/'); for (const [code] of families) { const family = read('careers/families/' + code + '/index.html'); const actual = [...family.matchAll(/href="\/careers\/(\d{2}-\d{4})\//g)].map(x => x[1]); assert.deepEqual(actual, careers.map(([id]) => id).filter(id=>id.startsWith(code+'-'))); } assert.match(read('careers/47-2111/index.html'), /learn-trade-electrical/); assert.match(read('careers/47-2152/index.html'), /learn-trade-plumbing/); assert.match(read('careers/49-9021/index.html'), /learn-trade-hvac/); assert.match(read('careers/15-2051/index.html'), /weekly counts with missing values/); }); test('all 216 curated roles plus 30 project support tracks have dedicated guides', () => { const roster = read('volunteer/index.html'); const paths = new Set([...roster.matchAll(/href="(\/volunteer\/learn\/[a-z0-9-]+\/)"/g)].map(x=>x[1])); assert.equal(paths.size, 246); for (const path of paths) verify(path); }); test('civilian energy requests and guides point to the same community and web fallback', () => { const roster = read('volunteer/index.html'); const fallback = 'https://projectatom.ai/nuclear-disarmament#civilian-energy'; const deepLink = 'glimmer://community/atom-civilian-nuclear-energy'; const scope = roster.split('id="civilian-nuclear-energy"')[1].split('')[0]; assert.ok(scope.includes(fallback)); assert.match(scope, /Public-source research and education only\./); assert.equal(scope.split(deepLink).length - 1, 3); const paths = new Set([...scope.matchAll(/href="(\/volunteer\/learn\/civilian-nuclear-[a-z-]+\/)"/g)].map(m => m[1])); assert.equal(paths.size, 3); for (const path of paths) { const guide = read(path.slice(1) + 'index.html'); assert.ok(guide.includes(deepLink) && guide.includes(fallback), path); assert.match(guide, /href="https:\/\/www\.(nrc|eia)\.gov\//, path); } }); test('solar roof role guides open the project community and provide a web fallback', () => { const roster = read('volunteer/index.html'); const fallback = 'https://projectatom.ai/#solar-roof-tiles'; const deepLink = 'glimmer://community/atom-build-solar-roof-tiles'; const section = roster.split('id="solar-roof-tiles"')[1].split('')[0]; assert.ok(section.includes(fallback)); assert.match(section, /one shared open tile design/); assert.match(section, /independent local teams/); assert.equal(section.split(deepLink).length - 1, 2); for (const path of ['roofing-and-building-envelope-engineer', 'solar-pv-and-roof-integration-specialist']) { const guide = read('volunteer/learn/' + path + '/index.html'); assert.ok(guide.includes(deepLink) && guide.includes(fallback), path); assert.match(guide, /href="https:\/\/www\.energy\.gov\//); } }); test('every role, career and family has unique local lazy-loaded art', () => { const unique = new Set(); const add = (path) => { const svg = read(path.slice(1)); assert.match(svg, //); assert.doesNotMatch(svg, /<(script|image|foreignObject)\b|https:\/\//); unique.add(svg); }; const verify = (html, n, prefix) => { const paths = [...html.matchAll(//g)] .map(m => m[1]).filter(path => path.startsWith(prefix)); assert.equal(paths.length, n, prefix); assert.equal(new Set(paths).size, n, prefix); for (const path of paths) add(path); }; const roster = read('volunteer/index.html'); verify(roster, 216, '/assets/role-art/volunteer/'); verify(read('careers/index.html'), 22, '/assets/role-art/family/'); for (const [code] of careers) { const image = '/assets/role-art/career/' + code + '.svg'; add(image); assert.ok(read('careers/' + code + '/index.html').includes(image), code); assert.ok(read('careers/families/' + code.slice(0, 2) + '/index.html').includes(image), code); } for (const match of roster.matchAll(/href="(\/volunteer\/learn\/[a-z0-9-]+\/)"/g)) { const page = read(match[1].slice(1) + 'index.html'); if (page.includes('/assets/role-art/support/')) verify(page, 1, '/assets/role-art/support/'); } assert.equal(unique.size, 1116); }); test('pet and distribution roles link to their exact Glimmer and web workstreams with local art', () => { const listing = read('volunteer/index.html'); for (const [slug, project, fragment = project] of [ ['cat-tree-and-pet-furniture-designer', 'cat-tree'], ['scratching-post-product-designer', 'scratching-post'], ['leash-and-collar-hardware-sourcing-volunteer', 'dog-walking-gear'], ['pet-friendly-textile-materials-developer', 'pet-friendly-fabrics'], ['local-vehicle-distribution-and-service-planner', 'global-distribution', 'global-product-distribution'], ['cross-border-freight-customs-and-sourcing-specialist', 'global-distribution', 'global-product-distribution'], ['local-delivery-network-and-driver-operations-planner', 'global-distribution', 'global-product-distribution'], ['shipping-platform-software-and-reliability-volunteer', 'global-distribution', 'global-product-distribution'], ]) { const card = listing.split('id="' + slug + '"')[1].split('

  2. \n ')[0].split('
  3. { const listing = read('volunteer/index.html'); const illustrations = []; for (const [group, slug, title, source, scope] of [ ['nanotechnology', 'nanotechnology-evidence-researcher', 'Nanotechnology evidence researcher', 'https://www.nano.gov/about-nanotechnology/', /No material fabrication, handling, product testing or field deployment/], ['quantum-computing', 'quantum-computing-simulator-researcher', 'Quantum computing simulator researcher', 'https://quantum.cloud.ibm.com/learning/courses/basics-of-quantum-information/quantum-circuits/introduction', /No hardware access, cloud account, cryptographic attacks/], ]) { const deepLink = 'glimmer://community/atom-' + group; const section = listing.split('id="' + group + '"')[1]?.split('')[0]; assert.ok(section && section.includes('id="' + slug + '"'), slug); assert.ok(section.includes(deepLink), slug); assert.match(section, scope, slug); const path = '/volunteer/learn/' + slug + '/'; verify(path, title); const guide = read(path.slice(1) + 'index.html'); assert.ok(guide.includes(deepLink) && guide.includes(source) && guide.includes('/volunteer/#' + slug), slug); assert.match(guide, scope, slug); const art = '/assets/role-art/volunteer/' + slug + '.svg'; assert.ok(section.includes(art) && guide.includes(art), slug); illustrations.push(read(art.slice(1))); } assert.notEqual(...illustrations); }); test('vehicle autonomy role remains in Motors and has offline-only scope, safety evidence, original art and exact route', () => { const listing = read('volunteer/index.html'); const section = listing.split('id="motors-robotics-and-space"')[1]?.split('')[0]; const slug = 'vehicle-autonomy-safety-researcher'; const card = section.split('id="' + slug + '"')[1]?.split('
  4. { const listing = read('volunteer/index.html'); const section = listing.split('id="motors-robotics-and-space"')[1].split('')[0]; for (const slug of [ 'charging-infrastructure-volunteer', 'ev-technician-or-mechanic', 'vehicle-autonomy-safety-researcher', 'ev-battery-and-bms-researcher', 'ev-motor-and-power-electronics-researcher', 'vehicle-chassis-brakes-and-steering-researcher', 'vehicle-embedded-systems-and-networks-researcher', 'vehicle-sensors-and-calibration-researcher', 'vehicle-perception-and-sensor-fusion-researcher', 'vehicle-localization-and-mapping-researcher', 'vehicle-planning-and-control-researcher', 'vehicle-simulation-and-qa-researcher', 'vehicle-functional-safety-and-human-factors-researcher', 'ev-manufacturing-and-quality-researcher', 'vehicle-defensive-cybersecurity-researcher' ]) { const card = section.split('id="' + slug + '"')[1]?.split('
  5. { const listing = read('volunteer/index.html'); const reviewed = [ ['electric-semi-trucks', 'electric-semi-truck-route-and-charging-researcher', /No vehicle operation, energized charging equipment/], ['electric-aircraft-propulsion', 'electric-aircraft-propulsion-feasibility-researcher', /No energized systems, propeller operation/], ['home-hvac', 'home-hvac-load-and-duct-design-researcher', /No installation or commissioning of real equipment/], ['home-hvac', 'home-heat-pump-performance-and-controls-researcher', /No installation or commissioning of real equipment/], ['home-hvac', 'home-ventilation-and-indoor-air-quality-researcher', /No installation or commissioning of real equipment/], ['home-hvac', 'home-hvac-installation-service-and-commissioning-researcher', /No installation or commissioning of real equipment/], ]; for (const [group, slug, scope] of reviewed) { assert.equal(listing.split('id="' + group + '"').length, 2, group); const section = listing.split('id="' + group + '"')[1].split('')[0]; const card = section.split('id="' + slug + '"')[1]?.split('
  6. { const slugs = [ 'home-architecture-and-maintainability-researcher', 'home-building-envelope-and-durability-researcher', 'home-renewable-energy-and-storage-integration-researcher', 'home-electronics-and-appliance-efficiency-researcher', 'home-water-and-plumbing-integration-researcher', 'home-shared-duct-coordination-and-commissioning-researcher', 'home-inclusive-design-and-accessibility-researcher', 'home-lifecycle-affordability-and-local-construction-researcher', ]; const listing = read('volunteer/index.html'); assert.equal(listing.split('id="integrated-open-homes"').length, 2); const section = listing.split('id="integrated-open-homes"')[1].split('')[0]; for (const slug of slugs) { assert.ok(section.includes('id="' + slug + '"'), slug); const card = section.split('id="' + slug + '"')[1].split('
  7. { const groups = { 'computing-hardware-design': [ 'computer-system-architecture-and-interconnect-researcher', 'computer-mechanical-thermal-and-service-design-researcher', 'computer-hardware-validation-and-accessibility-researcher', ], 'useful-connected-appliances': [ 'automatic-cooker-usability-and-safety-researcher', 'repairable-refrigerator-monitoring-and-controls-researcher', 'appliance-offline-firmware-and-interoperability-researcher', 'appliance-electronics-and-resilience-researcher', 'appliance-mechanical-failure-and-commissioning-safety-researcher', ], }; const listing = read('volunteer/index.html'); for (const [group, slugs] of Object.entries(groups)) { const section = listing.split('id="' + group + '"')[1]?.split('')[0] ?? ''; for (const slug of slugs) { const card = section.split('id="' + slug + '"')[1]?.split('
  8. { const roster = read('volunteer/index.html'); const projects = [ ['open-source-multimaterial-printer', 'atom-open-3d-printer', 6, /unpowered fixture/], ['additive-manufacturing-research', 'atom-additive-manufacturing', 2, /uncured resin/], ]; for (const [anchor, category, count, scope] of projects) { assert.ok(roster.includes('href="#' + anchor + '"'), anchor); const section = roster.split('id="' + anchor + '"')[1].split('')[0]; assert.match(section, scope, anchor); const cards = [...section.matchAll(/
  9. (.*?)<\/li>(?=
  10. )/gs)]; assert.equal(cards.length, count, anchor); for (const [, slug, card] of cards) { const path = '/volunteer/learn/' + slug + '/'; const image = '/assets/role-art/volunteer/' + slug + '.svg'; const deepLink = 'glimmer://community/' + category; for (const value of [path, image, deepLink, 'Community work in Glimmer ยท Unpaid']) assert.ok(card.includes(value), slug + ': ' + value); const guide = read(path.slice(1) + 'index.html'); for (const value of [deepLink, image, '/volunteer/#' + slug]) assert.ok(guide.includes(value), slug + ': ' + value); assert.ok(read(image.slice(1)).includes(' { const roster = read('volunteer/index.html'); assert.ok(roster.includes('href="#preventive-care-research"')); const section = roster.split('id="preventive-care-research"')[1].split('')[0]; assert.match(section, /alongside standard preventive services and indicated care/); assert.match(section, /No patient or animal contact, diagnosis, treatment, or clinical advice/); assert.match(section, /No drug development, promotion, sales, or distribution/); const route = 'glimmer://community/atom-preventive-care-research'; const titles = [ 'veterinarian-or-veterinary-scientist-for-preventive-health-research', 'preventive-medicine-clinician-or-public-health-scientist', 'dentist-dental-hygienist-or-oral-health-scientist', ]; assert.equal(section.split(route).length - 1, titles.length); for (const slug of titles) { const guide = read('volunteer/learn/' + slug + '/index.html'); const art = '/assets/role-art/volunteer/' + slug + '.svg'; assert.ok(section.includes(art) && guide.includes(art)); assert.ok(guide.includes(route) && guide.includes('/volunteer/#' + slug)); assert.ok(read(art.slice(1)).includes(' { const roster = read('volunteer/index.html'); const cards = [ ['dual-screen-foldable-phone', 'aosp-and-cuttlefish-platform-contributor', 'atom-build-flip-phone', /virtual device/, /not require a Google or Apple account/], ['linux-desktop-computers', 'linux-app-porting-and-accessibility-contributor', 'atom-build-linux-desktop', /disposable Linux VM/, /existing Mac and iPhone clients intact/], ['software-and-ai', 'glimmer-identity-and-cross-device-sync-contributor', 'atom-software', /first-party Glimmer sign-in/, /never real accounts or production records/], ]; assert.match(roster, /id="linux-desktop-accessibility-and-qa"/); assert.match(roster, /id="dual-screen-foldable-interaction-designer"/); for (const [anchor, slug, category, first, second] of cards) { const section = roster.split('id="' + anchor + '"')[1].split('')[0]; assert.ok(section.includes('id="' + slug + '"')); const guide = read('volunteer/learn/' + slug + '/index.html'); const art = '/assets/role-art/volunteer/' + slug + '.svg'; assert.ok(section.includes(art) && guide.includes(art)); assert.ok(guide.includes('glimmer://community/' + category)); assert.match(guide, first); assert.match(guide, second); assert.ok(read(art.slice(1)).includes(' { const roster = read('volunteer/index.html'); const anchor = 'lightwell-open-lighting'; const route = 'glimmer://community/atom-lightwell-open-lighting'; const website = 'https://hellolightwell.com/'; assert.ok(roster.includes('href="#' + anchor + '"')); const section = roster.split('id="' + anchor + '"')[1].split('')[0]; assert.ok(section.includes(website)); assert.match(section, /No product, sales, installation, or certification/); assert.match(section, /No mains wiring/); assert.match(section, /share a public work sample/); const titles = [ ['lightwell-mechanical-and-repairability-designer', /experience designing or building at least one lighting fixture/], ['lightwell-low-voltage-and-electrical-safety-contributor', /experience designing and testing at least one LED driver/], ['lightwell-matter-firmware-contributor', /experience commissioning and controlling at least one actual Matter device/], ['lightwell-local-controller-and-automation-designer', /experience implementing or integrating a local smart-home controller/], ['lightwell-validation-and-certification-planner', /electrical-product validation, lab testing or compliance experience/], ['lightwell-production-parts-and-documentation-contributor', /experience creating a manufacturing package/], ]; assert.equal(section.split(route).length - 1, titles.length); for (const [slug, experience] of titles) { const guide = read('volunteer/learn/' + slug + '/index.html'); const art = '/assets/role-art/volunteer/' + slug + '.svg'; assert.ok(section.includes(art) && guide.includes(art)); for (const value of [route, website, '/volunteer/#' + slug]) assert.ok(guide.includes(value), slug + ': ' + value); assert.match(guide, experience); assert.ok(read(art.slice(1)).includes(' { const roster = read('volunteer/index.html'); const anchor = 'open-garden-design'; const route = 'glimmer://community/atom-open-garden-design'; assert.ok(roster.includes('href="#' + anchor + '"')); const section = roster.split('id="' + anchor + '"')[1].split('')[0]; assert.match(section, /native Mac app for garden and interior design/); assert.match(section, /replaceable furniture/); assert.match(section, /interior scenes from multiple photos/); assert.ok(section.includes('/assets/open-garden-design.svg')); assert.match(read('assets/open-garden-design.svg'), /width="1200" height="630"/); assert.match(section, /Unpaid, optional community work/); assert.doesNotMatch(section, /Gemini|Google|Plasticity|volunteer with us/i); const roles = [ ['garden-house-modeling-and-mac-3d-engineer', /STL as optional exchange/], ['garden-plant-catalog-and-horticulture-researcher', /check taxonomy and distribution/], ['garden-3d-plant-artist-and-asset-librarian', /redistribution and attribution record/], ['garden-layout-and-mac-accessibility-designer', /with a keyboard and with VoiceOver|with only a keyboard and with VoiceOver/], ['garden-atom-design-assistance-and-qa-contributor', /dismissing a suggestion leaves the plan unchanged/], ]; assert.equal(section.split(route).length - 1, roles.length); const illustrations = new Set(); for (const [slug, evidence] of roles) { const guide = read('volunteer/learn/' + slug + '/index.html'); const art = '/assets/role-art/volunteer/' + slug + '.svg'; assert.ok(section.includes(art) && guide.includes(art), slug); assert.ok(guide.includes(route), slug); assert.ok(guide.includes('/volunteer/#' + slug), slug); assert.match(guide, evidence, slug); const image = read(art.slice(1)); assert.match(image, / { const roster=read('volunteer/index.html'); const section=roster.split('id="data-centers-power-and-manufacturing"')[1].split('')[0]; const work=[ ['first-party-hosting-platform-and-reliability-researcher', /target availability, recovery and data-loss/], ['hosting-transit-dns-and-tls-researcher', /two fictional carrier paths/], ['data-center-acquisition-diligence-researcher', /utility capacity and lead time/], ['hosting-cost-and-capacity-analyst', /low, expected and high utilization/], ['hosting-operations-and-security-planning-researcher', /tabletop outage discussion/], ]; assert.match(section, /No facility or hosting service is open. These roles are unpaid research only/); assert.ok(section.includes('/assets/first-party-hosting-concept.png')); assert.ok(section.includes('id="data-center-network-engineer"')); assert.ok(section.includes('id="worldwide-data-center-site-planner"')); for (const [slug, marker] of work) { const guide=read('volunteer/learn/'+slug+'/index.html'); const art='/assets/role-art/volunteer/'+slug+'.svg'; assert.ok(section.includes(art) && guide.includes(art), slug); assert.ok(guide.includes('glimmer://community/atom-data-centers-trades'), slug); assert.match(guide, marker, slug); assert.match(guide, /Use public references, fictional sites and synthetic workloads/); assert.ok(read(art.slice(1)).includes(' { const roster = read('volunteer/index.html'); const group = 'electric-boats-and-dockside-charging'; const route = 'glimmer://community/atom-electric-boats'; assert.ok(roster.includes('href="#' + group + '"')); const section = roster.split('id="' + group + '"')[1].split('')[0]; assert.match(section, /small non-passenger battery-electric boats/); assert.match(section, /separate desk-only feasibility study/); const slugs = [ 'electric-boat-hull-and-route-modeling-contributor', 'electric-marine-propulsion-and-controls-contributor', 'marine-battery-safety-contributor', 'dockside-charging-and-marina-planning-contributor', 'electric-boat-testing-and-lifecycle-research-contributor', 'civilian-nuclear-electric-cruise-feasibility-researcher', ]; assert.equal(section.split(route).length - 1, slugs.length); for (const slug of slugs) { const art = '/assets/role-art/volunteer/' + slug + '.svg'; assert.ok(section.includes('id="' + slug + '"')); assert.ok(section.includes(art)); assert.match(read(art.slice(1)), /