Skip to content

Commit

Permalink
Add a test for the TS fix
Browse files Browse the repository at this point in the history
  • Loading branch information
szmarczak committed Jul 5, 2020
1 parent 676be6d commit ed897d7
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/merge-instances.ts
@@ -1,6 +1,6 @@
import test from 'ava';
import {Handler} from 'express';
import got, {BeforeRequestHook, Got, Headers} from '../source';
import got, {BeforeRequestHook, Got, Headers, NormalizedOptions} from '../source';
import withServer from './helpers/with-server';

const echoHeaders: Handler = (request, response) => {
Expand Down Expand Up @@ -146,3 +146,17 @@ test('merging instances with HTTPS options undefined', t => {
t.true(merged.defaults.options.https?.rejectUnauthorized);
t.is(merged.defaults.options.https?.certificate, undefined);
});

test('accepts options for promise API', t => {
got.extend({
hooks: {
beforeRequest: [
(options: NormalizedOptions): void => {
options.responseType = 'buffer';
}
]
}
});

t.pass();
});

0 comments on commit ed897d7

Please sign in to comment.