The current app at root of repo is for single frictionless dataset. Should be in its own example so we have space going forward for multiple example and for root to have core portal.js code. * Also refactor its README (moved from root) to reflect it is just an example * Move design content from the root README.md into DESIGN.md * Stub a new root README.md based largely on examples/catalog/README.md
33 lines
877 B
JavaScript
33 lines
877 B
JavaScript
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)
|
|
)
|
|
})
|
|
}); |