@@ -6,23 +6,20 @@ const Lab = require('lab'),
66const { buildRenderer, testRunner} = require ( "../spec-helpers" ) ;
77const { expect} = require ( "code" ) ;
88const {
9- resourceHintAllowedTypes,
109 resourceHintAllowedStates,
1110 resourceHintAllowedCors
1211} = require ( "../../helpers/lib/resourceHints" ) ;
1312
14- function template ( path , state , type , cors ) {
15- type = type ? `type="${ type } "` : '' ;
13+ function template ( path , state , cors ) {
1614 cors = cors ? `cors="${ cors } "` : '' ;
17- return `{{ earlyHint "${ path } " "${ state } " ${ type } ${ cors } }}` ;
15+ return `{{ earlyHint "${ path } " "${ state } " ${ cors } }}` ;
1816}
1917
2018function randommer ( items ) {
2119 return ( ) => items [ Math . floor ( Math . random ( ) * items . length ) ] ;
2220}
2321
2422const randomHintState = randommer ( Object . values ( resourceHintAllowedStates ) ) ;
25- const randomHintType = randommer ( Object . values ( resourceHintAllowedTypes ) ) ;
2623const randomCors = randommer ( Object . values ( resourceHintAllowedCors ) ) ;
2724
2825let renderer , runTests ;
@@ -54,10 +51,9 @@ describe('earlyHint', () => {
5451
5552 it ( 'should create a resource hint with all the properties' , done => {
5653 const path = '/asset/theme.css'
57- const type = randomHintType ( ) ;
5854 const state = randomHintState ( ) ;
5955 const cors = randomCors ( ) ;
60- const input = template ( path , state , type , cors ) ;
56+ const input = template ( path , state , cors ) ;
6157 runTests ( [
6258 {
6359 input,
@@ -66,7 +62,7 @@ describe('earlyHint', () => {
6662 ] , ( ) => {
6763 const hints = renderer . getResourceHints ( ) ;
6864 expect ( hints ) . to . have . length ( 1 ) ;
69- expect ( hints [ 0 ] ) . to . equals ( { src : path , state, type , cors} ) ;
65+ expect ( hints [ 0 ] ) . to . equals ( { src : path , state, cors} ) ;
7066 done ( ) ;
7167 } ) ;
7268 } ) ;
0 commit comments