-
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.
test(tests): ✅ Add test module for
get-first-from
function in list …
…module Add a new test module for the `get-first-from` function to ensure its correctness and robustness. This enhances code reliability and facilitates maintenance. No significant side effects foreseen. Fix #257
- Loading branch information
1 parent
6c72f3a
commit 45d067b
Showing
2 changed files
with
56 additions
and
0 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,50 @@ | ||
@charset "UTF-8"; | ||
|
||
// @description | ||
// * get-first-from function. | ||
// * This module tests a functionality of get-first-from function. | ||
|
||
// @access private | ||
|
||
// @version 1.0.0 | ||
|
||
// @author Khaled Mohamed | ||
|
||
// @license MIT | ||
|
||
// @repository: https://github.com/krypton225/sass-pire | ||
|
||
// @namespace list | ||
|
||
// @module list/get-first-element.test | ||
|
||
// @dependencies: | ||
// * - True.describe (true function). | ||
// * - True.it (true function). | ||
// * - True.assert-equal (true function). | ||
// * - Dev.err (function). | ||
|
||
// stylelint-disable function-name-case | ||
|
||
@use "sass:map"; | ||
@use "../../../node_modules/sass-true/sass/true" as True; | ||
@use "../../../src/functions/list/get-first-element" as LibFunc; | ||
@use "../../../src/development-utils/error" as Dev; | ||
|
||
$test-cases-get-first-from-map: ( | ||
(1, 2, 4): 1, | ||
344px: Dev.err("The parameter of get-first-from function must be in a list type."), | ||
(69, 48, 54, (32, (11, 43))): 69, | ||
((true, false), (0, "Just a text"), (2, 32, 4)): true, | ||
(89, 48, 54, (32, (11, 43, (21, (11, "Yes"))))): 89, | ||
true: Dev.err("The parameter of get-first-from function must be in a list type."), | ||
"Just a number": Dev.err("The parameter of get-first-from function must be in a list type.") | ||
); | ||
|
||
@each $case, $result in $test-cases-get-first-from-map { | ||
@include True.describe("[Function] get-first-from(#{$case}), Result: #{$result}") { | ||
@include True.it("get-first-from( #{$case}).") { | ||
@include True.assert-equal(LibFunc.get-first-from($case), $result); | ||
} | ||
} | ||
} |
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