Skip to content

Commit

Permalink
get my imports working
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Sep 23, 2020
1 parent a83d273 commit 7be4adb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 33 deletions.
4 changes: 2 additions & 2 deletions tests/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
require = require("esm")(module);
const fs = require("fs");
const path = require("path");
const { extractOptions, getAction } = require("../src/utils.js");
const actions = require("../src/actions.js");
const { extractOptions, getAction } = require("../src/utils.mjs");
const actions = require("../src/actions.mjs");

const feature = {
type: "Feature",
Expand Down
32 changes: 4 additions & 28 deletions tests/events.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
require = require("esm")(module);
const fs = require("fs");
const path = require("path");
const mock = require("./mocks.mjs");

const Ulysses = require("../src/main.js");
const Ulysses = require("../src/main.mjs").default;

const fires = JSON.parse(
fs.readFileSync(path.resolve(__dirname, "../docs/examples/data/fires-2018.json"))
Expand All @@ -12,37 +13,12 @@ let story;
let map;

beforeEach(() => {
map = new MockMap();
map = new mock.Map();
story = new Ulysses({ map, steps: fires });
});

describe("tests for events", () => {
test("register a listener", () => {
//story.on("step", e => {});
story.on("step", e => {});
});
});

// like a mapbox map, except it doesn't do anything
class MockMap {
constructor() {
// each log item is a pair of [string, array]
// with the name of a method and its arguments
this.log = [];
}

record(name, args) {
this.log.push([name, args]);
}

fitBounds(...args) {
this.record("fitBounds", args);
}

flyTo(...args) {
this.record("flyTo", args);
}

getMaxZoom(...args) {
this.record("getMaxZoom", args);
}
}
4 changes: 1 addition & 3 deletions tests/mocks.js → tests/mocks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Mocked objects that record what happens
*/

// like a mapbox map, except it doesn't do anything
class Map {
export class Map {
constructor() {
// each log item is a pair of [string, array]
// with the name of a method and its arguments
Expand All @@ -26,5 +26,3 @@ class Map {
this.record("getMaxZoom", args);
}
}

module.exports = { Map };

0 comments on commit 7be4adb

Please sign in to comment.