-
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.
- Loading branch information
1 parent
699eb87
commit d025437
Showing
11 changed files
with
928 additions
and
847 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,44 +1,53 @@ | ||
const globals = require("../core/global-functions"); | ||
|
||
describe("globals", () => { | ||
describe("sanitize_greyDirection", () => { | ||
it('should return numbers for strings', () => { | ||
expect(globals.sanitize_greyDirection('left')).toBe(1); | ||
expect(globals.sanitize_greyDirection("right")).toBe(2); | ||
expect(globals.sanitize_greyDirection("up")).toBe(3); | ||
expect(globals.sanitize_greyDirection("down")).toBe(4); | ||
}); | ||
describe("sanitize_greyDirection", () => { | ||
it("should return numbers for strings", () => { | ||
expect(globals.sanitize_greyDirection("left")).toBe(1); | ||
expect(globals.sanitize_greyDirection("right")).toBe(2); | ||
expect(globals.sanitize_greyDirection("up")).toBe(3); | ||
expect(globals.sanitize_greyDirection("down")).toBe(4); | ||
}); | ||
|
||
it('should fail with unknown value', () => { | ||
expect(() => { | ||
globals.sanitize_greyDirection("kittens"); | ||
}).toThrowErrorMatchingSnapshot(); | ||
}); | ||
}); | ||
it("should fail with unknown value", () => { | ||
expect(() => { | ||
globals.sanitize_greyDirection("kittens"); | ||
}).toThrowErrorMatchingSnapshot(); | ||
}); | ||
}); | ||
|
||
describe("sanitize_greyContentEdge", () => { | ||
it("should return numbers for strings", () => { | ||
expect(globals.sanitize_greyContentEdge("left")).toBe(0); | ||
expect(globals.sanitize_greyContentEdge("right")).toBe(1); | ||
expect(globals.sanitize_greyContentEdge("top")).toBe(2); | ||
expect(globals.sanitize_greyContentEdge("bottom")).toBe(3); | ||
}); | ||
describe("sanitize_greyContentEdge", () => { | ||
it("should return numbers for strings", () => { | ||
expect(globals.sanitize_greyContentEdge("left")).toBe(0); | ||
expect(globals.sanitize_greyContentEdge("right")).toBe(1); | ||
expect(globals.sanitize_greyContentEdge("top")).toBe(2); | ||
expect(globals.sanitize_greyContentEdge("bottom")).toBe(3); | ||
}); | ||
|
||
it("should fail with unknown value", () => { | ||
expect(() => { | ||
globals.sanitize_greyContentEdge("kittens"); | ||
}).toThrowErrorMatchingSnapshot(); | ||
}); | ||
}); | ||
it("should fail with unknown value", () => { | ||
expect(() => { | ||
globals.sanitize_greyContentEdge("kittens"); | ||
}).toThrowErrorMatchingSnapshot(); | ||
}); | ||
}); | ||
|
||
describe("sanitize_uiAccessibilityTraits", () => { | ||
it("should return numbers for traits", () => { | ||
expect(globals.sanitize_uiAccessibilityTraits(["button", "link"])).toBe(3); | ||
expect(globals.sanitize_uiAccessibilityTraits(["summary", "allowsDirectInteraction"])).toBe(16896); | ||
}); | ||
describe("sanitize_uiAccessibilityTraits", () => { | ||
it("should return numbers for traits", () => { | ||
expect(globals.sanitize_uiAccessibilityTraits(["button", "link"])).toBe( | ||
3 | ||
); | ||
expect( | ||
globals.sanitize_uiAccessibilityTraits([ | ||
"summary", | ||
"allowsDirectInteraction" | ||
]) | ||
).toBe(16896); | ||
}); | ||
|
||
it("should throw if unknown trait is accessed", () => { | ||
expect(() => globals.sanitize_uiAccessibilityTraits(["unknown"])).toThrowErrorMatchingSnapshot(); | ||
}); | ||
}); | ||
}); | ||
it("should throw if unknown trait is accessed", () => { | ||
expect(() => | ||
globals.sanitize_uiAccessibilityTraits(["unknown"]) | ||
).toThrowErrorMatchingSnapshot(); | ||
}); | ||
}); | ||
}); |
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,13 +1,17 @@ | ||
const { methodNameToSnakeCase } = require('../helpers'); | ||
const { methodNameToSnakeCase } = require("../helpers"); | ||
|
||
describe("helpers", () => { | ||
describe("methodNameToSnakeCase", () => { | ||
it("should not fail with empty string", () => { | ||
expect(() => methodNameToSnakeCase("")).not.toThrow(); | ||
}); | ||
describe("methodNameToSnakeCase", () => { | ||
it("should not fail with empty string", () => { | ||
expect(() => methodNameToSnakeCase("")).not.toThrow(); | ||
}); | ||
|
||
it("should return the correct snake case method name", () => { | ||
expect(methodNameToSnakeCase("actionForScrollInDirection:amount:xOriginStartPercentage:yOriginStartPercentage:")).toMatchSnapshot(); | ||
}); | ||
}); | ||
it("should return the correct snake case method name", () => { | ||
expect( | ||
methodNameToSnakeCase( | ||
"actionForScrollInDirection:amount:xOriginStartPercentage:yOriginStartPercentage:" | ||
) | ||
).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.