import { getShellExportCommands , ShadowboxSettings } from "./server_install" ; describe ( 'getShellExportCommands' , ( ) => { it ( 'fully populated' , ( ) => { const settings = { imageId : 'foo' , metricsUrl : 'https://metrics.example/' , sentryApiUrl : 'https://sentry.example/' , watchtowerRefreshSeconds : 999 } ; const serverName = 'Outline Server Foo' ; expect ( getShellExportCommands ( settings , serverName ) ) . toEqual ( 'export SB_IMAGE=\'foo\'\n' + 'export WATCHTOWER_REFRESH_SECONDS=\'999\'\n' + 'export SENTRY_API_URL=\'https://sentry.example/\'\n' + 'export SB_METRICS_URL=\'https://metrics.example/\'\n' + 'export SB_DEFAULT_SERVER_NAME="$(printf \'Outline Server Foo\')"\n' ) ; } ) ; it ( 'minimal' , ( ) => { const settings = { imageId : null , metricsUrl : '' } ; const serverName = '' ; expect ( getShellExportCommands ( settings , serverName ) ) . toEqual ( 'export SB_DEFAULT_SERVER_NAME="$(printf \'\')"\n' ) ; } ) ; it ( 'server name escaping' , ( ) => { const settings = { imageId : '' , metricsUrl : null } ; const serverName = 'Outline Server فرانكفورت' ; expect ( getShellExportCommands ( settings , serverName ) ) . toEqual ( 'export SB_DEFAULT_SERVER_NAME="$(printf \'Outline Server \\u0641\\u0631\\u0627\\u0646\\u0643\\u0641\\u0648\\u0631\\u062a\')"\n' ) ; } ) ; } ) ;