Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Dec 16, 2024
1 parent 485d34c commit 5a7f586
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions bin/prepare-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { basename, extname, join, resolve } from 'node:path';
import { copyFile, readdir, readFile, writeFile } from 'node:fs/promises';
import { parseSpec, astToESM } from '@uwdata/mosaic-spec';
import { parse } from 'yaml';
import pgk from '../packages/spec/package.json' with { type: "json" };
import pkg from '../packages/spec/package.json' with { type: "json" };

// This script prepares all Mosaic example specifications
// ...AND WILL OVERWRITE EXISTING TEST CASE DATA AND DOCS!
Expand All @@ -12,6 +12,8 @@ import pgk from '../packages/spec/package.json' with { type: "json" };
// - YAML, non-parsed JSON, and ESM code written to /docs/public/specs
// - Example Markdown pages written to /docs/examples

const {version} = pkg;

const specDir = join('specs', 'yaml');
const esmTestDir = join('specs', 'esm');
const jsonTestDir = join('specs', 'json');
Expand Down Expand Up @@ -51,7 +53,7 @@ const files = await Promise.allSettled((await readdir(specDir))
writeFile(
resolve(jsonTestDir, `${base}.json`),
JSON.stringify({
$schema: `https://idl.uw.edu/mosaic/schema/v${pgk.version}.json`,
$schema: `https://idl.uw.edu/mosaic/schema/v${version}.json`,
...ast.toJSON()
}, 0, 2)
),
Expand Down
6 changes: 4 additions & 2 deletions packages/spec/test/spec.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import Ajv from 'ajv';
import ajvFormats from 'ajv-formats';
import { specs, loadJSON, loadJSONSchema, loadESM } from './load-specs.js';
import { astToESM, parseSpec } from '../src/index.js';
import pgk from '../package.json' with { type: "json" };
import pkg from '../package.json' with { type: "json" };

const {version} = pkg;

// initialize JSON schema validator
const validator = new Ajv({
Expand Down Expand Up @@ -33,7 +35,7 @@ for (const [name, spec] of specs) {
it(`produces json output`, async () => {
const ast = parseSpec(spec);
const json = JSON.stringify({
$schema: `https://idl.uw.edu/mosaic/schema/v${pgk.version}.json`,
$schema: `https://idl.uw.edu/mosaic/schema/v${version}.json`,
...ast.toJSON()
}, 0, 2);
expect(json).toBe(await loadJSON(name));
Expand Down

0 comments on commit 5a7f586

Please sign in to comment.