import * as act from "@siteimprove/alfa-act" ; import { Future } from "@siteimprove/alfa-future" ; import { None , Option } from "@siteimprove/alfa-option" ; import { Question } from "../../src/common/question" ; function wrapper < TYPE , SUBJECT , CONTEXT , ANSWER , T , URI extends keyof Question . Metadata > ( question , answer ) { return Future . now ( Option . of ( answer ) ) ; } const dontKnow = Future . now ( None ) ; export function oracle < I , T , S > ( answers ) { return ( rule , question ) => { if ( answers [ question . uri ] === undefined ) { return dontKnow ; } switch ( question . type ) { case "boolean" : return wrapper ( question , answers [ question . uri ] ! ) ; case "node" : return wrapper ( question , answers [ question . uri ] ! ) ; case "node[]" : return wrapper ( question , answers [ question . uri ] ! ) ; case "color[]" : return wrapper ( question , answers [ question . uri ] ! ) ; case "string" : return wrapper ( question , answers [ question . uri ] ! ) ; } } ; }