1- import { Relayer , StarshipConfig } from '@starship-ci/types' ;
1+ import { StarshipConfig } from '@starship-ci/types' ;
22
3- import { applyDefaults , deepMerge , DefaultsManager } from '../src/defaults' ;
3+ import { applyDefaults , deepMerge } from '../src/defaults' ;
44
55describe ( 'DefaultsManager' , ( ) => {
6- let defaultsManager : DefaultsManager ;
7-
8- beforeEach ( ( ) => {
9- defaultsManager = new DefaultsManager ( ) ;
10- } ) ;
11-
126 describe ( 'applyDefaults' , ( ) => {
137 it ( 'should apply defaults to a full config' , ( ) => {
148 const config : StarshipConfig = {
@@ -26,7 +20,7 @@ describe('DefaultsManager', () => {
2620 }
2721 }
2822 ] ,
29- relayers : [ ] ,
23+ relayers : [ ]
3024 } ;
3125
3226 const processedConfig = applyDefaults ( config ) ;
@@ -35,10 +29,16 @@ describe('DefaultsManager', () => {
3529 expect ( processedConfig . chains ) . toHaveLength ( 1 ) ;
3630 expect ( processedConfig . chains ! [ 0 ] . faucet ?. enabled ) . toBe ( true ) ;
3731 expect ( processedConfig . chains ! [ 0 ] . faucet ?. type ) . toBe ( 'cosmjs' ) ;
38- expect ( processedConfig . chains ! [ 0 ] . faucet ?. image ) . toBe ( 'ghcr.io/hyperweb-io/starship/cosmjs-faucet:xyz' ) ;
39- expect ( processedConfig . exposer ?. image ) . toBe ( 'ghcr.io/hyperweb-io/starship/exposer:20250205-544757d' ) ;
32+ expect ( processedConfig . chains ! [ 0 ] . faucet ?. image ) . toBe (
33+ 'ghcr.io/hyperweb-io/starship/cosmjs-faucet:xyz'
34+ ) ;
35+ expect ( processedConfig . exposer ?. image ) . toBe (
36+ 'ghcr.io/hyperweb-io/starship/exposer:20250205-544757d'
37+ ) ;
4038 expect ( processedConfig . faucet ?. enabled ) . toBe ( true ) ;
41- expect ( processedConfig . faucet ?. image ) . toBe ( 'ghcr.io/hyperweb-io/starship/faucet:20250325-2207109' ) ; // default faucet
39+ expect ( processedConfig . faucet ?. image ) . toBe (
40+ 'ghcr.io/hyperweb-io/starship/faucet:20250325-2207109'
41+ ) ; // default faucet
4242 expect ( processedConfig . monitoring ?. enabled ) . toBe ( false ) ;
4343 expect ( processedConfig . ingress ?. enabled ) . toBe ( false ) ;
4444 expect ( processedConfig . ingress ?. type ) . toBe ( 'nginx' ) ;
@@ -57,15 +57,19 @@ describe('DefaultsManager', () => {
5757 enabled : true ,
5858 type : 'starship' ,
5959 image : 'ghcr.io/hyperweb-io/starship/faucet:xyz'
60- } ,
60+ }
6161 } ;
6262
6363 const processedConfig = applyDefaults ( config ) ;
6464
65- expect ( processedConfig . exposer ?. image ) . toBe ( 'ghcr.io/hyperweb-io/starship/exposer:xyz' ) ;
65+ expect ( processedConfig . exposer ?. image ) . toBe (
66+ 'ghcr.io/hyperweb-io/starship/exposer:xyz'
67+ ) ;
6668 expect ( processedConfig . faucet ?. enabled ) . toBe ( true ) ;
6769 expect ( processedConfig . faucet ?. type ) . toBe ( 'starship' ) ;
68- expect ( processedConfig . faucet ?. image ) . toBe ( 'ghcr.io/hyperweb-io/starship/faucet:xyz' ) ;
70+ expect ( processedConfig . faucet ?. image ) . toBe (
71+ 'ghcr.io/hyperweb-io/starship/faucet:xyz'
72+ ) ;
6973 } ) ;
7074
7175 it ( 'should process relayers in a full config' , ( ) => {
@@ -115,12 +119,12 @@ describe('DefaultsManager', () => {
115119 name : 'cosmoshub' as const ,
116120 id : 'chain1' ,
117121 numValidators : 1 ,
118- image : 'ghcr.io/hyperweb-io/starship/chain:xyz' ,
122+ image : 'ghcr.io/hyperweb-io/starship/chain:xyz'
119123 } ,
120124 {
121125 name : 'osmosis' as const ,
122126 id : 'chain2' ,
123- numValidators : 1 ,
127+ numValidators : 1
124128 }
125129 ] ,
126130 relayers : [
@@ -135,17 +139,25 @@ describe('DefaultsManager', () => {
135139 type : 'hermes' as const ,
136140 name : 'test-hermes' ,
137141 chains : [ 'osmosis' , 'cosmoshub' ] ,
138- replicas : 1 ,
142+ replicas : 1
139143 }
140- ] ,
144+ ]
141145 } ;
142146
143147 const processedConfig = applyDefaults ( config ) ;
144148
145- expect ( processedConfig . relayers ! [ 0 ] . image ) . toBe ( 'ghcr.io/hyperweb-io/starship/hermes:xyz' ) ;
146- expect ( processedConfig . chains ! [ 0 ] . image ) . toBe ( 'ghcr.io/hyperweb-io/starship/chain:xyz' ) ;
147- expect ( processedConfig . relayers ! [ 1 ] . image ) . toBe ( 'ghcr.io/cosmology-tech/starship/hermes:1.10.0' ) ; // default hermes image
148- expect ( processedConfig . chains ! [ 1 ] . image ) . toBe ( 'ghcr.io/cosmology-tech/starship/osmosis:v25.0.0' ) ; // default osmosis image
149+ expect ( processedConfig . relayers ! [ 0 ] . image ) . toBe (
150+ 'ghcr.io/hyperweb-io/starship/hermes:xyz'
151+ ) ;
152+ expect ( processedConfig . chains ! [ 0 ] . image ) . toBe (
153+ 'ghcr.io/hyperweb-io/starship/chain:xyz'
154+ ) ;
155+ expect ( processedConfig . relayers ! [ 1 ] . image ) . toBe (
156+ 'ghcr.io/cosmology-tech/starship/hermes:1.10.0'
157+ ) ; // default hermes image
158+ expect ( processedConfig . chains ! [ 1 ] . image ) . toBe (
159+ 'ghcr.io/cosmology-tech/starship/osmosis:v25.0.0'
160+ ) ; // default osmosis image
149161 } ) ;
150162
151163 describe ( 'deepMerge utility' , ( ) => {
0 commit comments