import { Terminal } from '../Terminal' ; import { StringBufferTerminalProvider } from '../StringBufferTerminalProvider' ; import { createColorGrid } from './createColorGrid' ; import { AnsiEscape } from '../AnsiEscape' ; describe ( 'Colors' , ( ) => { let terminal ; let provider ; beforeEach ( ( ) => { provider = new StringBufferTerminalProvider ( true ) ; terminal = new Terminal ( provider ) ; } ) ; test ( 'writes color grid correctly' , ( ) => { for ( const line of createColorGrid ( ) ) { terminal . writeLine ( ... line ) ; } expect ( provider . getOutput ( ) ) . toMatchSnapshot ( ) ; } ) ; test ( 'correctly normalizes color codes for tests' , ( ) => { for ( const line of createColorGrid ( ) ) { terminal . writeLine ( ... line ) ; } expect ( AnsiEscape . formatForTests ( provider . getOutput ( { normalizeSpecialCharacters : false } ) ) ) . toMatchSnapshot ( ) ; } ) ; } ) ;