-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
94 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,45 @@ | ||
import test from "ava"; | ||
import path from "path"; | ||
|
||
import { txtReadTransformNode } from "../../dist/index-node.js"; | ||
import { | ||
txtReadTransformNode, | ||
txtWriteTransformNode, | ||
} from "../../dist/index-node.js"; | ||
|
||
import { testInputPath, verifyTestLinearTransform } from "./common.js"; | ||
import { | ||
testInputPath, | ||
testOutputPath, | ||
verifyTestLinearTransform, | ||
} from "./common.js"; | ||
|
||
const testInputFilePath = path.join(testInputPath, "LinearTransform.txt"); | ||
const testOutputFilePath = path.join( | ||
testOutputPath, | ||
"txt-test-write-LinearTransform.txt" | ||
); | ||
|
||
test("Test reading a Insight Legacy TXT transform file", async (t) => { | ||
test("Test reading an Insight Legacy TXT transform file", async (t) => { | ||
const { couldRead, transform } = await txtReadTransformNode( | ||
testInputFilePath | ||
); | ||
t.true(couldRead); | ||
verifyTestLinearTransform(t, transform); | ||
}); | ||
|
||
test("Test writing an Insight Legacy TXT transform file", async (t) => { | ||
const { couldRead, transform } = await txtReadTransformNode( | ||
testInputFilePath | ||
); | ||
t.true(couldRead); | ||
|
||
const { couldWrite } = await txtWriteTransformNode( | ||
transform, | ||
testOutputFilePath | ||
); | ||
t.true(couldWrite); | ||
|
||
const { couldRead: couldReadBack, transform: transformBack } = | ||
await txtReadTransformNode(testInputFilePath); | ||
t.true(couldReadBack); | ||
verifyTestLinearTransform(t, transformBack); | ||
}); |