commit
b39d3e72d5
@ -1,21 +0,0 @@
|
||||
name: dataset-frictionless
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
jest:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install modules
|
||||
run: |
|
||||
cd examples/dataset-frictionless
|
||||
yarn
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
cd examples/dataset-frictionless
|
||||
yarn test -u
|
||||
@ -1,51 +0,0 @@
|
||||
CBOE Volatility Index (VIX) time-series dataset including daily open, close,
|
||||
high and low. The CBOE Volatility Index (VIX) is a key measure of market
|
||||
expectations of near-term volatility conveyed by S&P 500 stock index option
|
||||
prices introduced in 1993.
|
||||
|
||||
## Data
|
||||
|
||||
From the [VIX FAQ][faq]:
|
||||
|
||||
> In 1993, the Chicago Board Options Exchange® (CBOE®) introduced the CBOE
|
||||
> Volatility Index®, VIX®, and it quickly became the benchmark for stock market
|
||||
> volatility. It is widely followed and has been cited in hundreds of news
|
||||
> articles in the Wall Street Journal, Barron's and other leading financial
|
||||
> publications. Since volatility often signifies financial turmoil, VIX is
|
||||
> often referred to as the "investor fear gauge".
|
||||
>
|
||||
> VIX measures market expectation of near term volatility conveyed by stock
|
||||
> index option prices. The original VIX was constructed using the implied
|
||||
> volatilities of eight different OEX option series so that, at any given time,
|
||||
> it represented the implied volatility of a hypothetical at-the-money OEX
|
||||
> option with exactly 30 days to expiration.
|
||||
>
|
||||
> The New VIX still measures the market's expectation of 30-day volatility, but
|
||||
> in a way that conforms to the latest thinking and research among industry
|
||||
> practitioners. The New VIX is based on S&P 500 index option prices and
|
||||
> incorporates information from the volatility "skew" by using a wider range of
|
||||
> strike prices rather than just at-the-money series.
|
||||
|
||||
[faq]: http://www.cboe.com/micro/vix/faq.aspx
|
||||
|
||||
## Preparation
|
||||
|
||||
Run the shell script:
|
||||
|
||||
. scripts/process.sh
|
||||
|
||||
Output data is in `data/`.
|
||||
|
||||
### TODO
|
||||
|
||||
* Incorporate computed historical data (1990-2003)
|
||||
* Consider incorporating VOX data
|
||||
|
||||
## License
|
||||
|
||||
No obvious statement on [historical data page][historical]. Given size and
|
||||
factual nature of the data and its source from a US company would imagine this
|
||||
was public domain and as such have licensed the Data Package under the Public
|
||||
Domain Dedication and License (PDDL).
|
||||
|
||||
[historical]: http://www.cboe.com/micro/vix/historical.aspx
|
||||
@ -1,112 +0,0 @@
|
||||
{
|
||||
"name": "finance-vix",
|
||||
"title": "VIX - CBOE Volatility Index",
|
||||
"homepage": "http://www.cboe.com/micro/VIX/",
|
||||
"version": "0.1.0",
|
||||
"license": "PDDL-1.0",
|
||||
"sources": [
|
||||
{
|
||||
"title": "CBOE VIX Page",
|
||||
"name": "CBOE VIX Page",
|
||||
"web": "http://www.cboe.com/micro/vix/historical.aspx"
|
||||
}
|
||||
],
|
||||
"resources": [
|
||||
{
|
||||
"name": "vix-daily",
|
||||
"path": "vix-daily.csv",
|
||||
"format": "csv",
|
||||
"mediatype": "text/csv",
|
||||
"schema": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "Date",
|
||||
"type": "date",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "VIXOpen",
|
||||
"type": "number",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "VIXHigh",
|
||||
"type": "number",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "VIXLow",
|
||||
"type": "number",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "VIXClose",
|
||||
"type": "number",
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"primaryKey": "Date"
|
||||
}
|
||||
}
|
||||
],
|
||||
"views": [
|
||||
{
|
||||
"name": "simple graph",
|
||||
"id": 1,
|
||||
"title": "title1",
|
||||
"specType": "simple",
|
||||
"spec": {
|
||||
"type": "line",
|
||||
"group": "VIXClose",
|
||||
"series": [
|
||||
"VIXOpen",
|
||||
"VIXHigh"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "plotly graph",
|
||||
"id": 2,
|
||||
"specType": "plotly",
|
||||
"resources": [
|
||||
"vix-daily"
|
||||
],
|
||||
"spec": {
|
||||
"group": "VIXClose",
|
||||
"series": [
|
||||
"VIXOpen",
|
||||
"VIXHigh",
|
||||
"VIXLow"
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"type": "bar"
|
||||
}
|
||||
],
|
||||
"layout": {
|
||||
"title": "Plotly Layout Title",
|
||||
"height": 450,
|
||||
"xaxis": {
|
||||
"title": "X Axis Title"
|
||||
},
|
||||
"yaxis": {
|
||||
"title": "Y Axis Title"
|
||||
},
|
||||
"font": {
|
||||
"family": "\"Open Sans\", verdana, arial, sans-serif",
|
||||
"size": 12,
|
||||
"color": "rgb(169, 169, 169)"
|
||||
},
|
||||
"titlefont": {
|
||||
"family": "\"Open Sans\", verdana, arial, sans-serif",
|
||||
"size": 17,
|
||||
"color": "rgb(76, 76, 76)"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"displayModeBar": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
Date,VIXOpen,VIXHigh,VIXLow,VIXClose
|
||||
2004-01-02,17.96,18.68,17.54,18.22
|
||||
2004-01-05,18.45,18.49,17.44,17.49
|
||||
2004-01-06,17.66,17.67,16.19,16.73
|
||||
2004-01-07,16.72,16.75,15.05,15.05
|
||||
2004-01-08,15.42,15.68,15.32,15.61
|
||||
2004-01-09,16.15,16.88,15.57,16.75
|
||||
2004-01-12,17.32,17.46,16.79,16.82
|
||||
2004-01-13,16.06,18.33,16.53,18.04
|
||||
2004-01-14,17.29,17.03,16.04,16.75
|
||||
2004-01-15,17.07,17.31,15.49,15.56
|
||||
2004-01-16,15.04,15.44,14.09,15
|
||||
2004-01-20,15.77,16.13,15.09,15.21
|
||||
2004-01-21,15.63,15.63,14.24,14.34
|
||||
2004-01-22,14.02,14.87,14.01,14.71
|
||||
2004-01-23,14.73,15.05,14.56,14.84
|
||||
2004-01-26,15.78,15.78,14.52,14.55
|
||||
2004-01-27,15.28,15.44,14.74,15.35
|
||||
2004-01-28,15.37,17.06,15.29,16.78
|
||||
2004-01-29,16.88,17.66,16.79,17.14
|
||||
|
@ -1,51 +0,0 @@
|
||||
CBOE Volatility Index (VIX) time-series dataset including daily open, close,
|
||||
high and low. The CBOE Volatility Index (VIX) is a key measure of market
|
||||
expectations of near-term volatility conveyed by S&P 500 stock index option
|
||||
prices introduced in 1993.
|
||||
|
||||
## Data
|
||||
|
||||
From the [VIX FAQ][faq]:
|
||||
|
||||
> In 1993, the Chicago Board Options Exchange® (CBOE®) introduced the CBOE
|
||||
> Volatility Index®, VIX®, and it quickly became the benchmark for stock market
|
||||
> volatility. It is widely followed and has been cited in hundreds of news
|
||||
> articles in the Wall Street Journal, Barron's and other leading financial
|
||||
> publications. Since volatility often signifies financial turmoil, VIX is
|
||||
> often referred to as the "investor fear gauge".
|
||||
>
|
||||
> VIX measures market expectation of near term volatility conveyed by stock
|
||||
> index option prices. The original VIX was constructed using the implied
|
||||
> volatilities of eight different OEX option series so that, at any given time,
|
||||
> it represented the implied volatility of a hypothetical at-the-money OEX
|
||||
> option with exactly 30 days to expiration.
|
||||
>
|
||||
> The New VIX still measures the market's expectation of 30-day volatility, but
|
||||
> in a way that conforms to the latest thinking and research among industry
|
||||
> practitioners. The New VIX is based on S&P 500 index option prices and
|
||||
> incorporates information from the volatility "skew" by using a wider range of
|
||||
> strike prices rather than just at-the-money series.
|
||||
|
||||
[faq]: http://www.cboe.com/micro/vix/faq.aspx
|
||||
|
||||
## Preparation
|
||||
|
||||
Run the shell script:
|
||||
|
||||
. scripts/process.sh
|
||||
|
||||
Output data is in `data/`.
|
||||
|
||||
### TODO
|
||||
|
||||
* Incorporate computed historical data (1990-2003)
|
||||
* Consider incorporating VOX data
|
||||
|
||||
## License
|
||||
|
||||
No obvious statement on [historical data page][historical]. Given size and
|
||||
factual nature of the data and its source from a US company would imagine this
|
||||
was public domain and as such have licensed the Data Package under the Public
|
||||
Domain Dedication and License (PDDL).
|
||||
|
||||
[historical]: http://www.cboe.com/micro/vix/historical.aspx
|
||||
@ -1,98 +0,0 @@
|
||||
{
|
||||
"name": "finance-vix",
|
||||
"title": "VIX - CBOE Volatility Index",
|
||||
"homepage": "http://www.cboe.com/micro/VIX/",
|
||||
"version": "0.1.0",
|
||||
"license": "PDDL-1.0",
|
||||
"sources": [
|
||||
{
|
||||
"title": "CBOE VIX Page",
|
||||
"name": "CBOE VIX Page",
|
||||
"web": "http://www.cboe.com/micro/vix/historical.aspx"
|
||||
}
|
||||
],
|
||||
"resources": [
|
||||
{
|
||||
"name": "vix-daily",
|
||||
"path": "vix-daily.csv",
|
||||
"format": "csv",
|
||||
"mediatype": "text/csv",
|
||||
"schema": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "Date",
|
||||
"type": "date",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "VIXOpen",
|
||||
"type": "number",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "VIXHigh",
|
||||
"type": "number",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "VIXLow",
|
||||
"type": "number",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "VIXClose",
|
||||
"type": "number",
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"primaryKey": "Date"
|
||||
}
|
||||
}
|
||||
],
|
||||
"views": [
|
||||
{
|
||||
"name": "plotly graph",
|
||||
"id": 2,
|
||||
"specType": "plotly",
|
||||
"resources": [
|
||||
"vix-daily"
|
||||
],
|
||||
"spec": {
|
||||
"group": "VIXClose",
|
||||
"series": [
|
||||
"VIXOpen",
|
||||
"VIXHigh",
|
||||
"VIXLow"
|
||||
],
|
||||
"data": [
|
||||
{
|
||||
"type": "bar"
|
||||
}
|
||||
],
|
||||
"layout": {
|
||||
"title": "Plotly Layout Title",
|
||||
"height": 450,
|
||||
"xaxis": {
|
||||
"title": "X Axis Title"
|
||||
},
|
||||
"yaxis": {
|
||||
"title": "Y Axis Title"
|
||||
},
|
||||
"font": {
|
||||
"family": "\"Open Sans\", verdana, arial, sans-serif",
|
||||
"size": 12,
|
||||
"color": "rgb(169, 169, 169)"
|
||||
},
|
||||
"titlefont": {
|
||||
"family": "\"Open Sans\", verdana, arial, sans-serif",
|
||||
"size": 17,
|
||||
"color": "rgb(76, 76, 76)"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"displayModeBar": false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
Date,VIXOpen,VIXHigh,VIXLow,VIXClose
|
||||
2004-01-02,17.96,18.68,17.54,18.22
|
||||
2004-01-05,18.45,18.49,17.44,17.49
|
||||
2004-01-06,17.66,17.67,16.19,16.73
|
||||
2004-01-07,16.72,16.75,15.05,15.05
|
||||
2004-01-08,15.42,15.68,15.32,15.61
|
||||
2004-01-09,16.15,16.88,15.57,16.75
|
||||
2004-01-12,17.32,17.46,16.79,16.82
|
||||
2004-01-13,16.06,18.33,16.53,18.04
|
||||
2004-01-14,17.29,17.03,16.04,16.75
|
||||
2004-01-15,17.07,17.31,15.49,15.56
|
||||
2004-01-16,15.04,15.44,14.09,15
|
||||
2004-01-20,15.77,16.13,15.09,15.21
|
||||
2004-01-21,15.63,15.63,14.24,14.34
|
||||
2004-01-22,14.02,14.87,14.01,14.71
|
||||
2004-01-23,14.73,15.05,14.56,14.84
|
||||
2004-01-26,15.78,15.78,14.52,14.55
|
||||
2004-01-27,15.28,15.44,14.74,15.35
|
||||
2004-01-28,15.37,17.06,15.29,16.78
|
||||
2004-01-29,16.88,17.66,16.79,17.14
|
||||
|
@ -1,51 +0,0 @@
|
||||
CBOE Volatility Index (VIX) time-series dataset including daily open, close,
|
||||
high and low. The CBOE Volatility Index (VIX) is a key measure of market
|
||||
expectations of near-term volatility conveyed by S&P 500 stock index option
|
||||
prices introduced in 1993.
|
||||
|
||||
## Data
|
||||
|
||||
From the [VIX FAQ][faq]:
|
||||
|
||||
> In 1993, the Chicago Board Options Exchange® (CBOE®) introduced the CBOE
|
||||
> Volatility Index®, VIX®, and it quickly became the benchmark for stock market
|
||||
> volatility. It is widely followed and has been cited in hundreds of news
|
||||
> articles in the Wall Street Journal, Barron's and other leading financial
|
||||
> publications. Since volatility often signifies financial turmoil, VIX is
|
||||
> often referred to as the "investor fear gauge".
|
||||
>
|
||||
> VIX measures market expectation of near term volatility conveyed by stock
|
||||
> index option prices. The original VIX was constructed using the implied
|
||||
> volatilities of eight different OEX option series so that, at any given time,
|
||||
> it represented the implied volatility of a hypothetical at-the-money OEX
|
||||
> option with exactly 30 days to expiration.
|
||||
>
|
||||
> The New VIX still measures the market's expectation of 30-day volatility, but
|
||||
> in a way that conforms to the latest thinking and research among industry
|
||||
> practitioners. The New VIX is based on S&P 500 index option prices and
|
||||
> incorporates information from the volatility "skew" by using a wider range of
|
||||
> strike prices rather than just at-the-money series.
|
||||
|
||||
[faq]: http://www.cboe.com/micro/vix/faq.aspx
|
||||
|
||||
## Preparation
|
||||
|
||||
Run the shell script:
|
||||
|
||||
. scripts/process.sh
|
||||
|
||||
Output data is in `data/`.
|
||||
|
||||
### TODO
|
||||
|
||||
* Incorporate computed historical data (1990-2003)
|
||||
* Consider incorporating VOX data
|
||||
|
||||
## License
|
||||
|
||||
No obvious statement on [historical data page][historical]. Given size and
|
||||
factual nature of the data and its source from a US company would imagine this
|
||||
was public domain and as such have licensed the Data Package under the Public
|
||||
Domain Dedication and License (PDDL).
|
||||
|
||||
[historical]: http://www.cboe.com/micro/vix/historical.aspx
|
||||
@ -1,131 +0,0 @@
|
||||
{
|
||||
"name": "finance-vix",
|
||||
"title": "VIX - CBOE Volatility Index",
|
||||
"homepage": "http://www.cboe.com/micro/VIX/",
|
||||
"version": "0.1.0",
|
||||
"license": "PDDL-1.0",
|
||||
"sources": [
|
||||
{
|
||||
"title": "CBOE VIX Page",
|
||||
"name": "CBOE VIX Page",
|
||||
"web": "http://www.cboe.com/micro/vix/historical.aspx"
|
||||
}
|
||||
],
|
||||
"resources": [
|
||||
{
|
||||
"name": "vix-daily",
|
||||
"path": "vix-daily.csv",
|
||||
"format": "csv",
|
||||
"mediatype": "text/csv",
|
||||
"schema": {
|
||||
"fields": [
|
||||
{
|
||||
"name": "Date",
|
||||
"type": "date",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "VIXOpen",
|
||||
"type": "number",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "VIXHigh",
|
||||
"type": "number",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "VIXLow",
|
||||
"type": "number",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"name": "VIXClose",
|
||||
"type": "number",
|
||||
"description": ""
|
||||
}
|
||||
],
|
||||
"primaryKey": "Date"
|
||||
}
|
||||
}
|
||||
],
|
||||
"views": [
|
||||
{
|
||||
"name": "vega4",
|
||||
"resources": [
|
||||
0
|
||||
],
|
||||
"specType": "vega",
|
||||
"spec": {
|
||||
"width": 600,
|
||||
"height": 300,
|
||||
"data": [
|
||||
{
|
||||
"name": "vix-daily"
|
||||
}
|
||||
],
|
||||
"scales": [
|
||||
{
|
||||
"name": "VIXOpen",
|
||||
"type": "point",
|
||||
"range": "width",
|
||||
"domain": {
|
||||
"data": "vix-daily",
|
||||
"field": "VIXOpen"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "VIXHigh",
|
||||
"type": "linear",
|
||||
"range": "height",
|
||||
"domain": {
|
||||
"data": "vix-daily",
|
||||
"field": "VIXHigh"
|
||||
}
|
||||
}
|
||||
],
|
||||
"axes": [
|
||||
{
|
||||
"orient": "bottom",
|
||||
"scale": "VIXOpen"
|
||||
},
|
||||
{
|
||||
"orient": "left",
|
||||
"scale": "VIXHigh"
|
||||
}
|
||||
],
|
||||
"marks": [
|
||||
{
|
||||
"type": "line",
|
||||
"from": {
|
||||
"data": "vix-daily"
|
||||
},
|
||||
"encode": {
|
||||
"enter": {
|
||||
"x": {
|
||||
"scale": "VIXOpen",
|
||||
"field": "VIXOpen"
|
||||
},
|
||||
"y": {
|
||||
"scale": "VIXHigh",
|
||||
"field": "VIXHigh"
|
||||
},
|
||||
"strokeWidth": {
|
||||
"value": 2
|
||||
}
|
||||
},
|
||||
"strokeOpacity": {
|
||||
"value": 1
|
||||
}
|
||||
},
|
||||
"hover": {
|
||||
"strokeOpacity": {
|
||||
"value": 0.5
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
Date,VIXOpen,VIXHigh,VIXLow,VIXClose
|
||||
2004-01-02,17.96,18.68,17.54,18.22
|
||||
2004-01-05,18.45,18.49,17.44,17.49
|
||||
2004-01-06,17.66,17.67,16.19,16.73
|
||||
2004-01-07,16.72,16.75,15.05,15.05
|
||||
2004-01-08,15.42,15.68,15.32,15.61
|
||||
2004-01-09,16.15,16.88,15.57,16.75
|
||||
2004-01-12,17.32,17.46,16.79,16.82
|
||||
2004-01-13,16.06,18.33,16.53,18.04
|
||||
2004-01-14,17.29,17.03,16.04,16.75
|
||||
2004-01-15,17.07,17.31,15.49,15.56
|
||||
2004-01-16,15.04,15.44,14.09,15
|
||||
2004-01-20,15.77,16.13,15.09,15.21
|
||||
2004-01-21,15.63,15.63,14.24,14.34
|
||||
2004-01-22,14.02,14.87,14.01,14.71
|
||||
2004-01-23,14.73,15.05,14.56,14.84
|
||||
2004-01-26,15.78,15.78,14.52,14.55
|
||||
2004-01-27,15.28,15.44,14.74,15.35
|
||||
2004-01-28,15.37,17.06,15.29,16.78
|
||||
2004-01-29,16.88,17.66,16.79,17.14
|
||||
|
@ -1,8 +0,0 @@
|
||||
module.exports = {
|
||||
testPathIgnorePatterns: ["<rootDir>/.next/", "<rootDir>/node_modules/", "<rootDir>/examples/catalog/*"],
|
||||
setupFilesAfterEnv: ["<rootDir>/tests/setupTests.js"],
|
||||
transform: {
|
||||
"^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
|
||||
"\\.(css|less|scss|sass)$": "identity-obj-proxy"
|
||||
}
|
||||
};
|
||||
@ -1,33 +0,0 @@
|
||||
import { getDataset } from "../../lib/dataset"
|
||||
import path from 'path'
|
||||
|
||||
let directory
|
||||
let dataset
|
||||
|
||||
beforeAll(async () => {
|
||||
directory = path.join(process.cwd(), 'fixtures', 'datasetsDoubleView')
|
||||
dataset = await getDataset(directory)
|
||||
})
|
||||
|
||||
describe("Dataset", () => {
|
||||
it("loads a dataset from a local folder", async () => {
|
||||
|
||||
expect(dataset).toStrictEqual(
|
||||
expect.objectContaining({
|
||||
readme: expect.any(String),
|
||||
readmeHtml: expect.any(String),
|
||||
descriptor: expect.any(Object),
|
||||
resources: expect.any(Object),
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("returns a resource with required fields", () => {
|
||||
const resource = dataset.resources[0]
|
||||
const expectedFields = ["path", "pathType", "name", "format", "mediatype",
|
||||
"schema", "encoding", "sample", "size"]
|
||||
expect(expectedFields).toStrictEqual(
|
||||
Object.keys(resource)
|
||||
)
|
||||
})
|
||||
});
|
||||
@ -1,78 +0,0 @@
|
||||
import path from 'path'
|
||||
import { getDataset } from "../../lib/dataset"
|
||||
import { addView, getDataForViewSpec } from '../../lib/utils'
|
||||
const plotlyDatasetsDirectory = path.join(process.cwd(), 'fixtures', 'datasetsPlotlyView')
|
||||
const vegaDatasetsDirectory = path.join(process.cwd(), 'fixtures', 'datasetsVegaView')
|
||||
const doubleDatasetsDirectory = path.join(process.cwd(), 'fixtures', 'datasetsDoubleView')
|
||||
|
||||
let plotlyDataset
|
||||
let vegaDataset
|
||||
let doubleDataset
|
||||
let plotlyDatasetWithView
|
||||
let vegaDatasetWithView
|
||||
let doubleDatasetWithView
|
||||
|
||||
beforeAll(async () => {
|
||||
plotlyDataset = await getDataset(plotlyDatasetsDirectory)
|
||||
vegaDataset = await getDataset(vegaDatasetsDirectory)
|
||||
doubleDataset = await getDataset(doubleDatasetsDirectory)
|
||||
|
||||
plotlyDatasetWithView = addView(plotlyDataset)
|
||||
vegaDatasetWithView = addView(vegaDataset)
|
||||
doubleDatasetWithView = addView(doubleDataset)
|
||||
});
|
||||
|
||||
|
||||
describe("AddView", () => {
|
||||
it("_value field is added to Plotly datapackage", () => {
|
||||
const resource = plotlyDatasetWithView.props.dataset.resources[0]
|
||||
expect("_values" in resource).toBe(true)
|
||||
expect(resource["_values"].length > 0).toBe(true)
|
||||
});
|
||||
it("Plotly spec is added to datapackage", () => {
|
||||
const spec = JSON.parse(plotlyDatasetWithView.props.specs)[0]
|
||||
expect(spec.specType).toBe("plotly")
|
||||
expect(spec.layout.title).toBe("Plotly Layout Title")
|
||||
expect(spec.data[0].x.length).toBeGreaterThan(0)
|
||||
expect(spec.data[0].y.length).toBeGreaterThan(0)
|
||||
});
|
||||
it("_value field is added to datapackage with double views", () => {
|
||||
const resources = doubleDatasetWithView.props.dataset.resources
|
||||
resources.map((resource) => {
|
||||
expect("_values" in resource).toBe(true)
|
||||
expect(resource["_values"].length > 0).toBe(true)
|
||||
})
|
||||
|
||||
});
|
||||
it("view spec is created for each view in a datapackage", () => {
|
||||
const specs = JSON.parse(doubleDatasetWithView.props.specs)
|
||||
const simpleSpec = specs[0]
|
||||
const plotlySpec = specs[1]
|
||||
|
||||
expect(simpleSpec.specType).toBe("simple")
|
||||
expect(simpleSpec.layout.title).toBe("title1")
|
||||
expect(simpleSpec.data[0].x.length).toBeGreaterThan(0)
|
||||
expect(simpleSpec.data[0].y.length).toBeGreaterThan(0)
|
||||
|
||||
expect(plotlySpec.specType).toBe("plotly")
|
||||
expect(plotlySpec.layout.title).toBe("Plotly Layout Title")
|
||||
expect(plotlySpec.data[0].x.length).toBeGreaterThan(0)
|
||||
expect(plotlySpec.data[0].y.length).toBeGreaterThan(0)
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
describe("getDataForViewSpec", () => {
|
||||
it("Generates right data for vega spec", ()=>{
|
||||
const resource = vegaDataset.resources[0]
|
||||
const data = getDataForViewSpec(resource, "vega")
|
||||
expect(data).toStrictEqual(resource.sample)
|
||||
})
|
||||
it("Generates right data for plotly spec", ()=>{
|
||||
const resource = plotlyDataset.resources[0]
|
||||
const data = getDataForViewSpec(resource, "plotly")
|
||||
expect(data).not.toStrictEqual(resource.sample[0])
|
||||
expect(data[0]).toStrictEqual(Object.keys(resource.sample[0]))
|
||||
})
|
||||
|
||||
})
|
||||
@ -1,2 +0,0 @@
|
||||
import 'jest-canvas-mock';
|
||||
import "@testing-library/jest-dom/extend-expect";
|
||||
Loading…
x
Reference in New Issue
Block a user