Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions test/cli-utils-test.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import api from '../mapshaper.js';
import assert from 'assert';
import path from 'path';
var cli = api.cli;

describe('mapshaper-cli-lib.js', function () {

describe('expandInputFiles()', function () {
it('files without wildcards are passed through (even missing files)', function () {
assert.deepEqual(cli.expandInputFiles(['missing.json']), ['missing.json']);
assert.deepEqual(cli.expandInputFiles(['missing.json']), ['missing.json'].map(path.normalize));
});

it('expands wild cards', function() {
assert.deepEqual(cli.expandInputFiles(['test/data/features/centroids/*.shp']),
['test/data/features/centroids/a.shp', 'test/data/features/centroids/b.shp']);
['test/data/features/centroids/a.shp', 'test/data/features/centroids/b.shp'].map(path.normalize));
})

it('expands wild cards 2', function() {
Expand All @@ -21,18 +22,18 @@ describe('mapshaper-cli-lib.js', function () {

it('expands wild card directories', function() {
assert.deepEqual(cli.expandInputFiles(['test/data/features/centroids*/*.shp']),
['test/data/features/centroids/a.shp', 'test/data/features/centroids/b.shp']);
['test/data/features/centroids/a.shp', 'test/data/features/centroids/b.shp'].map(path.normalize));
})

it('expands wild card directories, ignores matching directories with no matching files', function() {
assert.deepEqual(cli.expandInputFiles(['*/affine-test.mjs']),
['test/affine-test.mjs']);
['test/affine-test.mjs'].map(path.normalize));
})


it('expands wild card directories 2', function() {
assert.deepEqual(cli.expandInputFiles(['test/*/six_counties.shp']),
['test/data/six_counties.shp']);
['test/data/six_counties.shp'].map(path.normalize));
})

it('API error if wild card expansion fails', function() {
Expand Down
7 changes: 6 additions & 1 deletion test/commands-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ describe('mapshaper-run-commands.js', function () {
})
})

describe('stdin/stdout tests', function() {
describe('stdin/stdout tests', function() {
// Skip these tests on Windows due to stdin/stdout issues
if (process.platform === 'win32') {
console.log('Skipping stdin/stdout tests on Windows');
return;
}

it ("pass-through GeoJSON", function(done) {
var cmd = "- -o - -verbose"; // -verbose to check that messages aren't sent to stdout
Expand Down