@@ -27,6 +27,30 @@ function writeCompiledArtifact(filePath) {
2727 ) ;
2828}
2929
30+ function writeManifest ( filePath , overrides = { } ) {
31+ fs . mkdirSync ( path . dirname ( filePath ) , { recursive : true } ) ;
32+ fs . writeFileSync (
33+ filePath ,
34+ JSON . stringify (
35+ {
36+ appName : 'Test App' ,
37+ appSlug : 'test-app' ,
38+ ui : { baseUrl : 'http://127.0.0.1:3001/' } ,
39+ deployments : [
40+ {
41+ chainId : 314159 ,
42+ chainName : 'filecoin_calibration' ,
43+ contractAddress : '0x0000000000000000000000000000000000000001'
44+ }
45+ ] ,
46+ ...overrides
47+ } ,
48+ null ,
49+ 2
50+ )
51+ ) ;
52+ }
53+
3054function runTh ( args , cwd ) {
3155 const res = spawnSync ( 'node' , [ path . resolve ( 'packages/cli/dist/index.js' ) , ...args ] , {
3256 cwd,
@@ -270,13 +294,16 @@ describe('th ui sync', function () {
270294 const outDir = path . join ( dir , 'out' ) ;
271295 writeJson ( schemaPath , minimalSchema ( ) ) ;
272296 writeCompiledArtifact ( path . join ( outDir , 'compiled' , 'App.json' ) ) ;
297+ writeManifest ( path . join ( outDir , 'manifest.json' ) ) ;
273298
274299 const res = runTh ( [ 'ui' , 'sync' , schemaPath , '--out' , outDir ] , process . cwd ( ) ) ;
275300 expect ( res . status , res . stderr || res . stdout ) . to . equal ( 0 ) ;
276301
277302 expect ( fs . existsSync ( path . join ( outDir , 'ui' , 'package.json' ) ) ) . to . equal ( true ) ;
278303 expect ( fs . existsSync ( path . join ( outDir , 'ui' , 'src' , 'generated' , 'ths.ts' ) ) ) . to . equal ( true ) ;
279304 expect ( fs . existsSync ( path . join ( outDir , 'ui' , 'public' , 'compiled' , 'App.json' ) ) ) . to . equal ( true ) ;
305+ expect ( fs . existsSync ( path . join ( outDir , 'ui' , 'public' , 'manifest.json' ) ) ) . to . equal ( true ) ;
306+ expect ( fs . existsSync ( path . join ( outDir , 'ui' , 'public' , '.well-known' , 'tokenhost' , 'manifest.json' ) ) ) . to . equal ( true ) ;
280307 expect ( fs . existsSync ( path . join ( outDir , 'contracts' , 'App.sol' ) ) ) . to . equal ( false ) ;
281308 } ) ;
282309
0 commit comments