-
Notifications
You must be signed in to change notification settings - Fork 1
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
34 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React from "react"; | ||
import { isVariant } from "../utils"; | ||
import { ABFY_VARIANT } from "../utils/constants"; | ||
|
||
describe("isVariant function", () => { | ||
it("should return false if the child doesnt have any props property", () => { | ||
const child = React.createElement("div"); | ||
const result = isVariant(child); | ||
expect(result).toBe(false); | ||
}); | ||
|
||
it("should return flase if the child has props but no id", () => { | ||
const child = React.createElement("div", {}); | ||
const result = isVariant(child); | ||
expect(result).toBe(false); | ||
}); | ||
|
||
it("should return false if the child has id prop set to different value", () => { | ||
const child = React.createElement("div", { id: "someRandomValue" }); | ||
|
||
const result = isVariant(child); | ||
expect(result).toBe(false); | ||
}); | ||
|
||
it("should return true if the child has id prop set to different value", () => { | ||
const child = React.createElement("div", { id: ABFY_VARIANT }); | ||
|
||
const result = isVariant(child); | ||
expect(result).toBe(true); | ||
}); | ||
}); |
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