File tree Expand file tree Collapse file tree 3 files changed +13
-16
lines changed Expand file tree Collapse file tree 3 files changed +13
-16
lines changed Original file line number Diff line number Diff line change 1
1
// import type ModuleExec from "./moduleExec.js";
2
2
3
3
export interface ModuleOptions {
4
+ /** If false, lib won't validaet and will leave that to Yahoo */
5
+ validateOptions ?: boolean ;
6
+ /** If false, will pass back unvalidated / untyped result from Yahoo */
4
7
validateResult ?: boolean ;
8
+ /** Filename to use for cached result */
5
9
devel ?: boolean | string ;
6
- fetchOptions ?: object ;
10
+ /** Any options to pass to fetch() just for this request. */
11
+ fetchOptions ?: Parameters < typeof fetch > [ 1 ] ;
7
12
}
8
13
9
14
export interface ModuleOptionsWithValidateFalse extends ModuleOptions {
Original file line number Diff line number Diff line change @@ -54,14 +54,12 @@ describe("moduleExec", () => {
54
54
await expect ( rwo ( { invalid : true } ) ) . rejects . toThrow ( InvalidOptionsError ) ;
55
55
} ) ;
56
56
57
- /*
58
- XXX TODO
59
- * with new yf() option, and with moduleoptions
60
- it("throws InvalidOptions on invalid options with validateOptions = false", async () => {
61
- const rwo = (options: any) => yf.search("symbol", options);
62
- await expect(rwo({ invalid: true })).rejects.toThrow(InvalidOptionsError);
57
+ it ( "does not throw InvalidOptions on invalid options with validateOptions = false" , async ( ) => {
58
+ // deno-lint-ignore no-explicit-any
59
+ const rwo = ( options : any ) =>
60
+ yf . search ( "symbol" , options , { validateOptions : false } ) ;
61
+ await expect ( rwo ( { invalid : true } ) ) . resolves . toBeDefined ( ) ;
63
62
} ) ;
64
- */
65
63
66
64
it ( "accepts empty queryOptions" , async ( ) => {
67
65
await expect (
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import validateAndCoerceTypes, {
20
20
} from "./validateAndCoerceTypes.ts" ;
21
21
import csv2json from "./csv2json.ts" ;
22
22
import type { JSONSchema } from "./validate/index.ts" ;
23
+ import type { ModuleOptions } from "./moduleCommon.ts" ;
23
24
24
25
// The consuming module itself will have a stricter return type.
25
26
// deno-lint-ignore no-explicit-any
@@ -107,14 +108,7 @@ interface ModuleExecOptions {
107
108
transformWith ?: TransformFunc ;
108
109
} ;
109
110
110
- moduleOptions ?: {
111
- /** Allow validation failures to pass if false; */
112
- validateOptions ?: boolean ;
113
- /** Allow validation failures to pass if false; */
114
- validateResult ?: boolean ;
115
- /** Any options to pass to fetch() just for this request. */
116
- fetchOptions ?: Parameters < typeof fetch > [ 1 ] ;
117
- } ;
111
+ moduleOptions ?: ModuleOptions ;
118
112
}
119
113
120
114
// deno-lint-ignore no-explicit-any
You can’t perform that action at this time.
0 commit comments