import * as assert from 'assert' ; import { Localizer , ParameterizedString } from '../localization/localize' ; const namespaces = [ Localizer . Diagnostic , Localizer . DiagnosticAddendum , Localizer . CodeAction ] ; test ( 'Raw strings present' , ( ) => { const stringContentMap = new Map < string , string > ( ) ; namespaces . forEach ( ( namespace ) => { Object . keys ( namespace ) . forEach ( ( key ) => { const value = ( namespace as any ) [ key ] ( ) ; let formatString ; if ( value === undefined ) { assert . fail ( `Default value for localized string "${ key }" is missing` ) ; } else if ( typeof value === 'string' ) { formatString = value ; } else if ( value instanceof ParameterizedString ) { formatString = value . getFormatString ( ) ; if ( ! formatString ) { assert . fail ( `Format string for localized string "${ key }" is missing` ) ; } } else { assert . fail ( `Default value for localized string "${ key }" is unexpected type` ) ; } if ( stringContentMap . has ( formatString ) ) { assert . fail ( `Localized string for "${ key }" is duplicate of ${ stringContentMap . get ( formatString ) }` ) ; } stringContentMap . set ( formatString , key ) ; } ) ; } ) ; } ) ;