Describing Tests
@mixin test-module()
aliased as describe()
Test Modules are optional, and can be used to group tests and other modules for organizational purposes. Modules can be nested for additional organization.
Parameters
$name: (string)
module name
@content (code block)
Include all the tests & modules that are part of this module
Example
scss
@use 'sass:list';
// Module Group
@include true.test-module('zip [function]') {
// Test 1
@include true.test('Returns two lists zipped together') {
@include true.assert-equal(
list.zip(a b c, 1 2 3),
(a 1, b 2, c 3));
}
// Test 2
@include true.test('Returns three zipped lists') {
@include true.assert-equal(
list.zip(1px 1px 3px, solid dashed solid, red green blue),
(1px solid red, 1px dashed green, 3px solid blue));
}
}
css
compiled
@charset "UTF-8";
/* # Module: zip [function] */
/* ------------------------ */
/* Test: Returns two lists zipped together */
/* ✔ [assert-equal] Returns two lists zipped together */
/* */
/* Test: Returns three zipped lists */
/* ✔ [assert-equal] Returns three zipped lists */
/* */
/* */
Used By
@mixin describe()
@mixin test()
aliased as it()
The test()
wrapper-mixin groups related assertions,
to describe the behavior they are testing.
Tests should always contain one or more assertions.
Parameters
$name: (string)
Describe what is being tested
@content (code block)
Include any assertions that are part of this test
Example
scss
@use 'sass:list';
@include true.test('Returns lists zipped together') {
@include true.assert-equal(
list.zip(a b c, 1 2 3),
(a 1, b 2, c 3));
@include true.assert-equal(
list.zip(1px 1px 3px, solid dashed solid, red green blue),
(1px solid red, 1px dashed green, 3px solid blue));
}
css
compiled
@charset "UTF-8";
/* Test: Returns lists zipped together */
/* ✔ [assert-equal] Returns lists zipped together */
/* ✔ [assert-equal] Returns lists zipped together */
/* */