bockensm
02/15/2022, 9:50 PMbeforeeach in a given-when-then block in TestBox? It does not work like describe/it. I've tried it inside story and inside given and neither seem to do the trick.bockensm
02/15/2022, 9:53 PMcomponent extends = "tests.base.spec" {
function run() {
story( "we should be able to find preconnect domains from the included assets", function() {
beforeEach(
body: function( currentSpec, data ) {
variables.service = getMockService(
publicMethods: [
"getPreconnectDomainsFromIncludedAssets"
]
);
}
);
it( "should do a thing", function() {
debug( variables.service ); // defined here
} );
given( "an included JS asset internal to the website", function() {
debug(variables.service); // not defined here
when( "getting the list of domains", function() {
then( "there should be nothing found", function() {
} );
} );
} );
} );
}
}sknowlton
02/15/2022, 9:56 PMdescribe()sknowlton
02/15/2022, 9:57 PMstory()bockensm
02/15/2022, 9:57 PMstory() calls describe() under the hood so I see them as essentially the same thingsknowlton
02/15/2022, 9:58 PMdescribe( "Division assignment and calculation API Endpoint", () => {
beforeEach( function( currentSpec ) {
setup();
mockUserRequestObject( { 'isRegistrar' : true, 'userID' : createGUID() } );
} );
it( "Will reject a request to change a division from a user without permissions", ( t ) => {
request.securityObj.setIsRegistrar( false );
... blah blah blah
It's doing what it's supposed to therebockensm
02/15/2022, 9:58 PMgiven() and when() in-place of describe() function calls. The then() function call is an alternative for it() function calls."bockensm
02/15/2022, 10:00 PMbockensm
02/15/2022, 10:01 PMdescribe() blocksaliaspooryorik
aliaspooryorik
given "I have a basket with 2 items"
when "I check out"
then "it should charge the value of the basket"aliaspooryorik
it)