-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move detoxAction invocations to generated code
To do this I had to add some mechanisms to allow sanitizers to work with function names and arguments instead of only with types as before. Also some more types were enabled.
- Loading branch information
1 parent
259a903
commit e803911
Showing
10 changed files
with
259 additions
and
62 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
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
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,19 +1,45 @@ | ||
const t = require("babel-types"); | ||
const generator = require("../core/generator"); | ||
|
||
const { isNumber } = require("../core/type-checks"); | ||
const { isNumber, isString, isBoolean } = require("../core/type-checks"); | ||
const { callGlobal } = require("../helpers"); | ||
|
||
const typeCheckInterfaces = { | ||
Integer: isNumber, | ||
double: isNumber | ||
Double: isNumber, | ||
String: isString, | ||
boolean: isBoolean | ||
}; | ||
|
||
const contentSanitizersForFunction = { | ||
scrollInDirection: { | ||
argumentName: "direction", | ||
newType: "String", | ||
name: "sanitize_android_direction", | ||
value: callGlobal("sanitize_android_direction") | ||
}, | ||
swipeInDirection: { | ||
argumentName: "direction", | ||
newType: "String", | ||
name: "sanitize_android_direction", | ||
value: callGlobal("sanitize_android_direction") | ||
}, | ||
scrollToEdge: { | ||
argumentName: "edge", | ||
newType: "String", | ||
name: "sanitize_android_edge", | ||
value: callGlobal("sanitize_android_edge") | ||
} | ||
}; | ||
|
||
module.exports = generator({ | ||
typeCheckInterfaces, | ||
supportedContentSanitizersMap: {}, | ||
supportedTypes: ["Integer", "int", "double"], | ||
contentSanitizersForFunction, | ||
contentSanitizersForType: {}, | ||
supportedTypes: ["Integer", "int", "double", "Double", "boolean"], | ||
renameTypesMap: { | ||
int: "Integer" // TODO: add test | ||
int: "Integer", // TODO: add test | ||
double: "Double" | ||
}, | ||
classValue: ({ package: pkg, name }) => `${pkg}.${name}` | ||
}); |
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
Oops, something went wrong.