forked from Azure/azure-sdk-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Azure#2 from arpanlaha/ts
Initial processor testing
- Loading branch information
Showing
3 changed files
with
59 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* @fileoverview Testing processors | ||
* @author Arpan Laha | ||
*/ | ||
|
||
import * as plugin from "../src"; | ||
import { assert } from "chai"; | ||
|
||
/** | ||
* Test structure taken from https://github.com/azeemba/eslint-plugin-json/blob/master/test/test.js | ||
*/ | ||
describe("plugin", function() { | ||
describe("structure", function() { | ||
it("processors should a member of the plugin", function() { | ||
assert.property( | ||
plugin, | ||
"processors", | ||
"processors is not a member of the plugin" | ||
); | ||
}); | ||
it(".json should be a member of processors", function() { | ||
assert.property( | ||
plugin.processors, | ||
".json", | ||
".json is not a member of processors" | ||
); | ||
}); | ||
it("preprocess should be a member of .json", function() { | ||
assert.property( | ||
plugin.processors[".json"], | ||
"preprocess", | ||
"preprocess is not a member of .json" | ||
); | ||
}); | ||
it("postprocess should be a member of .json", function() { | ||
assert.property( | ||
plugin.processors[".json"], | ||
"postprocess", | ||
"postprocess is not a member of .json" | ||
); | ||
}); | ||
}); | ||
describe("preprocess", function() { | ||
const preprocess = plugin.processors[".json"].preprocess; | ||
it("preprocess should prepend 'const json = ' to the input and return its singleton array", function() { | ||
const input = "input"; | ||
const output = preprocess(input); | ||
assert.isArray(output, "preprocess should always return an array"); | ||
assert.strictEqual(output[0], "const json = input"); | ||
}); | ||
}); | ||
/** | ||
* TODO: Implement postprocess tests after functionality complete | ||
*/ | ||
}); |
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