Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiVolland committed Sep 12, 2024
1 parent 4e55e6e commit 867eb29
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ dist
binaries

output-bulk
output.map
output.qml
output.sld
TEST_OUTPUT.*
6 changes: 6 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ async function writeFile(
console.log(writeUnsupportedProperties);
}
output = writeOutput;
if (targetParser instanceof OpenLayersParser) {
output = JSON.stringify(readOutput, undefined, 2);
if (!output) {
throw new Error('OpenLayers style could not be converted to JSON.');
}
}
} else {
output = JSON.stringify(readOutput, undefined, 2);
}
Expand Down
8 changes: 4 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function runAllTests() {
let success = true;

// test sld to qgis
let outputFile = 'output.qml';
let outputFile = 'TEST_OUTPUT.qml';
let args = ['start', '--', '-s', 'sld', '-t', 'qgis', '-o', outputFile, 'testdata/sld/point_simplepoint.sld'];
runTest(args, outputFile);

Expand All @@ -35,16 +35,16 @@ function runAllTests() {
}

// test qgis to sld
outputFile = 'output.sld';
outputFile = 'TEST_OUTPUT.sld';
args = ['start', '--', '-s', 'qgis', '-t', 'sld', '-o', outputFile, 'testdata/point_simple.qml'];
runTest(args, outputFile);

if (checkFileCreated(outputFile) === false) {
success = false;
}

// test mapfile to geostyler
outputFile = 'output.map';
// test mapfile to openlayers
outputFile = 'TEST_OUTPUT.ol';
args = ['start', '--', '-s', 'mapfile', '-o', outputFile, 'testdata/point_simplepoint.map'];
runTest(args, outputFile);

Expand Down

0 comments on commit 867eb29

Please sign in to comment.