Skip to main content
Version: Current

foundation-testing

Home > @genesislcap/foundation-testing

foundation-testing package

Functions

FunctionDescription
createComponentSuite(title, elementNameOrGetter, context, registrations)Create component test suite.
createLogicSuite(title, context)Create logic test suite.
fixture(templateNameOrRegistry, options)Creates a test fixture suitable for testing custom elements, templates, and bindings.
resetTestHarness(wrapper)Resets the history of the spied functions on the objects so previous running tests don't affect the current test. Must be called at the end of every test even if not asserting on the spies.
restoreTestHarness(wrapper)Restores the spied functions back to the original functions without the spies.
runCases(fn, cases, assertion)Assert a set of test cases.
testSpy(constructor)Decorator: Used on a test harness class based on a FoundationElement to give it extra functionality which can be used during testing. *Important* this is to be used on a parent element compared to the element under test.

Interfaces

InterfaceDescription
ComponentContextComponent suite context interface
FixtureUnit test fixture.
FixtureOptionsOptions used to customize the creation of the unit test fixture.
LogicContextLogic suite context interface

Variables

VariableDescription
delayedResolveDelayed resolve utility.
loggerTest logger
timeoutTimeout utility.

Type Aliases

Type AliasDescription
ElementGetter
EqualExpects that the type parameter X is equal to Y, returning true or false
ExpectExpects that the type parameter T resolves to true, or will be a typescript error
FilterConditionallyFilters out key/value pairs from an object where they value does not match a condition
RunCases
SinonWrapperCrates an object with a key value pair for each spied function where the key is the function name and the value is the sinon wrapped spy function
SpiedFunctionsFilters out all key/value pairs which are not functions, and omits the constructor
SuiteCallbackDefines the Generic type for a test Suite T the callback function required to assert on type T.
WithTestHarnessType can be used to inform Typescript the object decorated with testSpy() has function spies which can be interacted upon their normal function reference