From 24c16d91da489001a967cc03e9fdb5915c6ec66b Mon Sep 17 00:00:00 2001 From: Hugues Stefanski Date: Mon, 29 Jan 2018 21:36:08 +0100 Subject: [PATCH] Completed tests for d3-fetch --- types/d3-fetch/d3-fetch-tests.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/types/d3-fetch/d3-fetch-tests.ts b/types/d3-fetch/d3-fetch-tests.ts index 9c88ed8674..1dfff0e04f 100644 --- a/types/d3-fetch/d3-fetch-tests.ts +++ b/types/d3-fetch/d3-fetch-tests.ts @@ -1,4 +1,5 @@ import * as d3Fetch from 'd3-fetch'; +import { DSVParsedArray, DSVRowString, DSVRowAny } from 'd3-dsv'; interface MyType { foo: string; @@ -13,10 +14,26 @@ promise = d3Fetch.blob(url); promise = d3Fetch.blob(url, init); promise = d3Fetch.buffer(url); promise = d3Fetch.buffer(url, init); - promise = d3Fetch.image(url); promise = d3Fetch.image(url, init); promise = d3Fetch.json(url); promise = d3Fetch.json(url, init); -let myString: Promise = d3Fetch.text(url); + +let myString: Promise; +myString = d3Fetch.text(url); myString = d3Fetch.text(url, init); + +const parseRow = (d: {}) => { + const myType: MyType = { foo: 'foo' }; + return myType; +}; +let promise2: Promise>; +promise2 = d3Fetch.csv(url); +promise2 = d3Fetch.csv(url, init); +promise2 = d3Fetch.csv(url, init, parseRow); +promise2 = d3Fetch.dsv(';', url); +promise2 = d3Fetch.dsv(';', url, init); +promise2 = d3Fetch.dsv(';', url, init, parseRow); +promise2 = d3Fetch.tsv(url); +promise2 = d3Fetch.tsv(url, init); +promise2 = d3Fetch.tsv(url, init, parseRow);