license fileoverview author lwe google import 'jasmine' ; import { Csp } from './csp' ; import { CspEvaluator } from './evaluator' ; import { Finding , Severity , Type } from './finding' ; describe ( 'Test evaluator' , ( ) => { it ( 'CspEvaluator' , ( ) => { const fakeCsp = new Csp ( ) ; const evaluator = new CspEvaluator ( fakeCsp ) ; expect ( evaluator . csp ) . toBe ( fakeCsp ) ; } ) ; it ( 'Evaluate' , ( ) => { const fakeCsp = new ( Csp ) ( ) ; const fakeFinding = new ( Finding ) ( Type . UNKNOWN_DIRECTIVE , 'Fake description' , Severity . MEDIUM , 'fake-directive' , 'fake-directive-value' ) ; const fakeVerifier = ( parsedCsp ) => { return [ fakeFinding ] ; } ; const evaluator = new ( CspEvaluator ) ( fakeCsp ) ; const findings = evaluator . evaluate ( [ fakeVerifier , fakeVerifier ] , [ fakeVerifier ] ) ; const expectedFindings = [ fakeFinding , fakeFinding , fakeFinding ] ; expect ( findings ) . toEqual ( expectedFindings ) ; } ) ; } ) ;