@@ -3,12 +3,20 @@ import test from 'node:test';
33import { verifyDesktopReleaseConfig } from './verify-desktop-release-config.mjs' ;
44
55const validPackage = {
6+ author : {
7+ name : 'ccofallen' ,
8+ email : 'ccofallen@users.noreply.github.com' ,
9+ } ,
10+ scripts : {
11+ 'desktop:pack' : 'npm run desktop:build && electron-builder --publish=never' ,
12+ 'desktop:pack:mac' : 'npm run desktop:pack -- --mac --arm64 --x64' ,
13+ } ,
614 build : {
715 appId : 'io.elevenlabs.codexpetpause' ,
816 productName : 'Codex Pet Pause' ,
917 mac : {
1018 icon : 'build/icons/icon.icns' ,
11- target : [ { target : 'dmg' , arch : [ 'arm64' , 'x64' ] } ] ,
19+ target : [ { target : 'dmg' } ] ,
1220 artifactName : 'Codex-Pet-Pause-${version}-mac-${arch}.${ext}' ,
1321 } ,
1422 win : {
@@ -18,11 +26,12 @@ const validPackage = {
1826 } ,
1927 linux : {
2028 icon : 'build/icons/png' ,
29+ maintainer : 'ccofallen <ccofallen@users.noreply.github.com>' ,
2130 target : [
2231 { target : 'AppImage' , arch : [ 'x64' ] } ,
2332 { target : 'deb' , arch : [ 'x64' ] } ,
2433 ] ,
25- artifactName : 'Codex-Pet-Pause-${version}-linux-${arch} .${ext}' ,
34+ artifactName : 'Codex-Pet-Pause-${version}-linux-x64 .${ext}' ,
2635 } ,
2736 } ,
2837} ;
@@ -40,7 +49,45 @@ test('accepts the approved desktop release contract', () => {
4049 ) ;
4150 assert . equal (
4251 validPackage . build . linux . artifactName ,
43- 'Codex-Pet-Pause-${version}-linux-${arch}.${ext}' ,
52+ 'Codex-Pet-Pause-${version}-linux-x64.${ext}' ,
53+ ) ;
54+ } ) ;
55+
56+ test ( 'requires the approved privacy-preserving Linux maintainer identity' , ( ) => {
57+ const missingAuthorEmail = structuredClone ( validPackage ) ;
58+ delete missingAuthorEmail . author . email ;
59+ const missingMaintainer = structuredClone ( validPackage ) ;
60+ delete missingMaintainer . build . linux . maintainer ;
61+ const invalidMaintainer = structuredClone ( validPackage ) ;
62+ invalidMaintainer . build . linux . maintainer = 'ccofallen' ;
63+
64+ assert . ok (
65+ verifyDesktopReleaseConfig ( missingAuthorEmail , ( ) => true )
66+ . some ( ( failure ) => failure . includes ( 'author' ) ) ,
67+ ) ;
68+ assert . ok (
69+ verifyDesktopReleaseConfig ( missingMaintainer , ( ) => true )
70+ . some ( ( failure ) => failure . includes ( 'Linux maintainer' ) ) ,
71+ ) ;
72+ assert . ok (
73+ verifyDesktopReleaseConfig ( invalidMaintainer , ( ) => true )
74+ . some ( ( failure ) => failure . includes ( 'Linux maintainer' ) ) ,
75+ ) ;
76+ } ) ;
77+
78+ test ( 'keeps mac config architecture-neutral and the local mac command explicitly dual-arch' , ( ) => {
79+ const embeddedArchitectures = structuredClone ( validPackage ) ;
80+ embeddedArchitectures . build . mac . target [ 0 ] . arch = [ 'arm64' , 'x64' ] ;
81+ const ambiguousLocalCommand = structuredClone ( validPackage ) ;
82+ ambiguousLocalCommand . scripts [ 'desktop:pack:mac' ] = 'npm run desktop:pack -- --mac' ;
83+
84+ assert . ok (
85+ verifyDesktopReleaseConfig ( embeddedArchitectures , ( ) => true )
86+ . some ( ( failure ) => failure . includes ( 'macOS architecture must be selected by the command' ) ) ,
87+ ) ;
88+ assert . ok (
89+ verifyDesktopReleaseConfig ( ambiguousLocalCommand , ( ) => true )
90+ . some ( ( failure ) => failure . includes ( 'local mac package command' ) ) ,
4491 ) ;
4592} ) ;
4693
@@ -69,7 +116,7 @@ test('rejects artifact names that differ from the release contract', () => {
69116 const invalid = structuredClone ( validPackage ) ;
70117 invalid . build . mac . artifactName = 'Codex-Pet-Pause-${version}-mac.${ext}' ;
71118 invalid . build . win . artifactName = 'Codex-Pet-Pause-${version}-win-${arch}.${ext}' ;
72- invalid . build . linux . artifactName = 'Codex-Pet-Pause-${version}-linux-${version }.${ext}' ;
119+ invalid . build . linux . artifactName = 'Codex-Pet-Pause-${version}-linux-${arch }.${ext}' ;
73120 const failures = verifyDesktopReleaseConfig ( invalid , ( ) => true ) ;
74121 assert . ok ( failures . some ( ( failure ) => failure . includes ( 'macOS artifact name' ) ) ) ;
75122 assert . ok ( failures . some ( ( failure ) => failure . includes ( 'Windows artifact name' ) ) ) ;
@@ -89,20 +136,20 @@ test('rejects unintended extra target formats on every platform', () => {
89136
90137test ( 'rejects unsupported or duplicate target architectures' , ( ) => {
91138 const invalid = structuredClone ( validPackage ) ;
92- invalid . build . mac . target [ 0 ] . arch . push ( 'arm64' ) ;
139+ invalid . build . mac . target [ 0 ] . arch = [ 'arm64' ] ;
93140 invalid . build . win . target [ 0 ] . arch . push ( 'arm64' ) ;
94141 invalid . build . linux . target [ 0 ] . arch . push ( 'arm64' ) ;
95142 invalid . build . linux . target [ 1 ] . arch . push ( 'x64' ) ;
96143 const failures = verifyDesktopReleaseConfig ( invalid , ( ) => true ) ;
97- assert . ok ( failures . some ( ( failure ) => failure . includes ( 'macOS DMG must target exactly arm64 and x64 ' ) ) ) ;
144+ assert . ok ( failures . some ( ( failure ) => failure . includes ( 'macOS architecture must be selected by the command ' ) ) ) ;
98145 assert . ok ( failures . some ( ( failure ) => failure . includes ( 'Windows NSIS must target exactly x64' ) ) ) ;
99146 assert . ok ( failures . some ( ( failure ) => failure . includes ( 'Linux AppImage must target exactly x64' ) ) ) ;
100147 assert . ok ( failures . some ( ( failure ) => failure . includes ( 'Linux DEB must target exactly x64' ) ) ) ;
101148} ) ;
102149
103150test ( 'rejects duplicate expected target definitions' , ( ) => {
104151 const invalid = structuredClone ( validPackage ) ;
105- invalid . build . mac . target . push ( { target : 'dmg' , arch : [ 'arm64' , 'x64' ] } ) ;
152+ invalid . build . mac . target . push ( { target : 'dmg' } ) ;
106153 invalid . build . win . target . push ( { target : 'nsis' , arch : [ 'x64' ] } ) ;
107154 invalid . build . linux . target . push ( { target : 'AppImage' , arch : [ 'x64' ] } ) ;
108155 const failures = verifyDesktopReleaseConfig ( invalid , ( ) => true ) ;
@@ -111,9 +158,8 @@ test('rejects duplicate expected target definitions', () => {
111158 assert . ok ( failures . some ( ( failure ) => failure . includes ( 'Linux targets must be exactly one AppImage entry and one deb entry' ) ) ) ;
112159} ) ;
113160
114- test ( 'accepts approved target and architecture entries in any order' , ( ) => {
161+ test ( 'accepts approved target entries in any order' , ( ) => {
115162 const reordered = structuredClone ( validPackage ) ;
116- reordered . build . mac . target [ 0 ] . arch = [ 'x64' , 'arm64' ] ;
117163 reordered . build . linux . target . reverse ( ) ;
118164 const failures = verifyDesktopReleaseConfig ( reordered , ( ) => true ) ;
119165 assert . deepEqual ( failures , [ ] ) ;
0 commit comments