@@ -885,7 +885,7 @@ describe('DockerService', () => {
885885 name : 'my network' ,
886886 description : 'network description' ,
887887 lndNodes : 1 ,
888- clightningNodes : 0 ,
888+ clightningNodes : 1 ,
889889 eclairNodes : 1 ,
890890 bitcoindNodes : 1 ,
891891 tapdNodes : 0 ,
@@ -899,6 +899,9 @@ describe('DockerService', () => {
899899 const eclairNodes = network . nodes . lightning . filter (
900900 n => n . implementation === 'eclair' ,
901901 ) ;
902+ const clightningNodes = network . nodes . lightning . filter (
903+ n => n . implementation === 'c-lightning' ,
904+ ) ;
902905 beforeEach ( ( ) => {
903906 // Add simulation config to the test network
904907 network . simulation = {
@@ -960,9 +963,9 @@ describe('DockerService', () => {
960963 } ) ;
961964
962965 it ( 'should handle errors when using unsupported node types' , async ( ) => {
963- network . nodes . lightning [ 0 ] . implementation = 'c-lightning ' ;
966+ network . nodes . lightning [ 0 ] . implementation = 'litd ' ;
964967 await expect ( dockerService . startSimulation ( network ) ) . rejects . toThrow (
965- 'unsupported node implementation: c-lightning ' ,
968+ 'unsupported node implementation: litd ' ,
966969 ) ;
967970 } ) ;
968971
@@ -984,5 +987,40 @@ describe('DockerService', () => {
984987 expect . stringContaining ( `container_name: polar-n1-simln` ) ,
985988 ) ;
986989 } ) ;
990+
991+ // Now we should be able to use c-lightning in the simulation
992+ it ( 'should add c-lightning to the docker-compose.yml file' , async ( ) => {
993+ network . simulation = {
994+ networkId : 1 ,
995+ source : clightningNodes [ 0 ] ,
996+ destination : eclairNodes [ 0 ] ,
997+ intervalSecs : 60 ,
998+ amountMsat : 1000 ,
999+ status : Status . Stopped ,
1000+ } ;
1001+ dockerService . saveComposeFile ( network ) ;
1002+ expect ( filesMock . write ) . toHaveBeenCalledWith (
1003+ expect . stringContaining ( 'docker-compose.yml' ) ,
1004+ expect . stringContaining ( `container_name: polar-n1-simln` ) ,
1005+ ) ;
1006+
1007+ composeMock . upOne . mockResolvedValue ( mockResult ) ;
1008+ await dockerService . startSimulation ( network ) ;
1009+
1010+ // Verify directories were created
1011+ expect ( fsMock . ensureDir ) . toHaveBeenCalled ( ) ;
1012+
1013+ // Verify sim.json was written with correct config
1014+ expect ( filesMock . write ) . toHaveBeenCalledWith (
1015+ expect . stringContaining ( 'sim.json' ) ,
1016+ expect . stringContaining ( clightningNodes [ 0 ] . name ) ,
1017+ ) ;
1018+
1019+ // Verify docker compose command was called
1020+ expect ( composeMock . upOne ) . toHaveBeenCalledWith (
1021+ 'simln' ,
1022+ expect . objectContaining ( { cwd : network . path } ) ,
1023+ ) ;
1024+ } ) ;
9871025 } ) ;
9881026} ) ;
0 commit comments