Branchwell

Jobley / website · jobley.ai / test / careers.test.mjs

1import assert from 'node:assert/strict';
2import { readFileSync } from 'node:fs';
3import test from 'node:test';
4const read = name => readFileSync(new URL('../' + name, import.meta.url), 'utf8');
5const source = JSON.parse(read('tools/career-titles.json'));
6const {careers, families} = JSON.parse(read('assets/career-directory.json'));
7const expectedTrades = new Set([...read('volunteer/index.html').matchAll(/glimmer:\/\/community\/atom-([a-z0-9-]+)/g)].map(match => match[1]));
8
9test('directory preserves every BLS civilian title across all 22 families, without duplication', () => {
10 assert.equal(source.length, 848);
11 assert.equal(new Set(source.map(([code]) => code)).size, 848);
12 assert.equal(families.length, 22);
13 assert.deepEqual(careers.map(row => row.slice(0, 2)), source);
14 assert.ok(careers.every(([code]) => /^\d{2}-\d{4}$/.test(code) && !code.startsWith('55-')));
15 assert.deepEqual(new Set(careers.map(([code]) => code.slice(0, 2))), new Set(families.map(([code]) => code)));
16 assert.ok(careers.some(([code, title, trade, aliases]) => title === 'Software Developers' && aliases.includes('coder')));
17});
18
19test('every family and career resolves to the existing Glimmer trade communities', () => {
20 assert.equal(expectedTrades.size, 50);
21 assert.ok(families.every(([, , trade]) => expectedTrades.has(trade)));
22 assert.ok(careers.every(([, , trade]) => !trade || expectedTrades.has(trade)));
23 const hrefs = [...read('careers/index.html').matchAll(/glimmer:\/\/community\/atom-([a-z0-9-]+)/g)];
24 assert.equal(hrefs.length, 23);
25 assert.ok(hrefs.every(([, trade]) => expectedTrades.has(trade)));
26});
27
28test('career directory is volunteer-only, discoverable and distinct from the existing roster', () => {
29 const page = read('careers/index.html');
30 assert.match(page, /unpaid volunteer ideas, not openings, shifts, or commitments/);
31 assert.match(page, /No forms or résumé are needed/);
32 assert.match(page, /independently qualified and authorized/);
33 assert.doesNotMatch(page, /JobPosting|baseSalary|<form|\/api\/candidates/);
34 assert.match(read('index.html'), /href="\/careers\/">Explore by career/);
35 assert.match(read('volunteer/index.html'), /href="\/careers\/">Explore by career/);
36 assert.match(read('sitemap.xml'), /https:\/\/jobley.ai\/careers\//);
37});
38
39test('independent print project is discoverable and documents four roles without application intake', () => {
40 const route = '/projects/print-and-fulfillment/';
41 const page = read('projects/print-and-fulfillment/index.html');
42 assert.match(page, /Independent project brief/);
43 assert.match(page, /cotton and performance tees/);
44 assert.match(page, /Business cards are on hold/);
45 assert.match(page, /No sign-ups are open or collected here/);
46 assert.doesNotMatch(page, /JobPosting|baseSalary|<form|mailto:|\/api\/candidates/);
47 assert.match(page, /Worldwide fulfillment is a goal, not current coverage/);
48 assert.ok(read('careers/index.html').includes('href="' + route + '"'));
49 assert.ok(read('sitemap.xml').includes('https://jobley.ai' + route));
50 for (const slug of ['apparel-sourcing', 'garment-printing', 'shipping-operations', 'print-prepress']) {
51 assert.ok(page.includes('id="' + slug + '"'));
52 assert.ok(page.includes('src="/assets/role-art/project-print/' + slug + '.svg"'));
53 assert.match(read('assets/role-art/project-print/' + slug + '.svg'), /<svg/);
54 }
55});
56
57test('pet food research is discoverable with five roles, safety gates and no intake', () => {
58 const route = '/projects/pet-food-and-treats/';
59 const page = read('projects/pet-food-and-treats/index.html');
60 assert.match(page, /one complete adult dog food and one separate complete adult cat food/);
61 assert.match(page, /professional safety release/);
62 assert.match(page, /No sign-ups are open or collected here/);
63 assert.doesNotMatch(page, /JobPosting|baseSalary|<form|mailto:|\/api\/candidates/);
64 assert.ok(read('careers/index.html').includes('href="' + route + '"'));
65 assert.ok(read('sitemap.xml').includes('https://jobley.ai' + route));
66 for (const slug of ['pet-food-science', 'veterinary-nutrition', 'us-sourcing', 'food-safety', 'palatability-research']) {
67 assert.ok(page.includes('id="' + slug + '"'));
68 const art = 'assets/role-art/project-pet-food/' + slug + '.svg';
69 assert.ok(page.includes('src="/' + art + '"'));
70 assert.match(read(art), /<svg/);
71 }
72});