-
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): ✅ Forward list utilities & add testing for
flatten
fun…
…ction Add forwarding for `list` module in functions index. Introduce a new test module for the flatten function with comprehensive test cases. The testing aims to ensure the accuracy and robustness of the flatten function for various input scenarios. Fix #255
- Loading branch information
1 parent
acdf549
commit 375ab18
Showing
3 changed files
with
73 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
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,49 @@ | ||
@charset "UTF-8"; | ||
|
||
// @description | ||
// * flatten function. | ||
// * This module tests a functionality of flatten function. | ||
|
||
// @access private | ||
|
||
// @version 1.0.0 | ||
|
||
// @author Khaled Mohamed | ||
|
||
// @license MIT | ||
|
||
// @repository: https://github.com/krypton225/sass-pire | ||
|
||
// @namespace global | ||
|
||
// @module global/flatten.test | ||
|
||
// @dependencies: | ||
// * - true.describe (true function). | ||
// * - true.it (true function). | ||
// * - true.assert-equal (true function). | ||
// * - err (function). | ||
|
||
@use "sass:map"; | ||
@use "../../../node_modules/sass-true/sass/true" as True; | ||
@use "../../../src/functions/list/flatten-list" as func; | ||
@use "../../../src/development-utils/error" as dev; | ||
|
||
$test-cases-flatten-list-map: ( | ||
(1, 2, 4): (1 2 4), | ||
344px: dev.err("The parameter of flatten function must be in a list type."), | ||
(69, 48, 54, (32, (11, 43))): (69 48 54 32 11 43), | ||
((true, false), (0, "Just a text"), (2, 32, 4)): (true false 0 "Just a text" 2 32 4), | ||
(69, 48, 54, (32, (11, 43, (21, (11, "Yes"))))): (69 48 54 32 11 43 21 11 "Yes"), | ||
true: dev.err("The parameter of flatten function must be in a list type."), | ||
"Just a number": dev.err("The parameter of flatten function must be in a list type."), | ||
false: dev.err("The parameter of flatten function must be in a list type."), | ||
); | ||
|
||
@each $case, $result in $test-cases-flatten-list-map { | ||
@include True.describe("[Function] flatten(#{$case}), Result: #{$result}") { | ||
@include True.it("Cut the unit of (#{$case}) value.") { | ||
@include True.assert-equal(func.flatten($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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@charset "UTF-8"; | ||
|
||
// @description | ||
// * This file forwards key functionalities from other modules. | ||
// * for easy access in the current stylesheet. | ||
|
||
// @author Khaled Mohamed | ||
|
||
// @license MIT | ||
|
||
// @repository: https://github.com/krypton225/sass-pire | ||
|
||
// @namespace functions/list | ||
|
||
// * flatten-list forward. | ||
// * forwarding the testing flatten function. | ||
// * please see testing `flatten` function for details. | ||
// @see flatten-list | ||
@forward "flatten-list.test"; |