I can find no documentation on this. The only way I see is to test a class that has the mixin added, but this is not a sound way of testing.
/// example mixin
///
mixin TestMixin {
String testing(String abc) {
print("your function logic goes here");
return abc;
}
}
/// This is just a helper class to get all the [mixin] functions
///
class FunctionHoldingClassForMixin with TestMixin {}
Now you can use this in main function as shown below.
void main() {
late FunctionHoldingClassForMixin mockClass;
setUp(() {
mockClass = FunctionHoldingClassForMixin();
});
test("mention what you wanna test", () {
var result = mockClass.testing("testing abc");
expect(result, "testing abc");
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With