Get help with testing, discuss unit testing strategies etc.


Post by jaa1be »

Hi all,
I want to write some standalone Unit-Test for my ExtJS6 UI-Component Classes from a package and have a problem to load the application-all.css because in this case I don't really have a application. And if I want to test a Class, how could the corresponding scss be loaded for this class.
My harness looks like this:
harness.configure({
    title: 'my-common tests',
    loaderPath  : {
        'My.common': '../src'
    },
    preload     : [
        // version of ExtJS used by your application
        // (not needed if you use Sencha Cmd which builds a complete 'all-file' including Ext JS itself)
        '../../../../applications/MyApplication/bootstrap.css', //dependency to Applications CSS
        '../../../../ext/build/ext-all-debug.js',
        {
            text: harness.getLoaderPathHook() //get loaderPath config before executing load mocked data
        }

    ]

});

harness.start(
    {
        group : 'Unit',
        requires: [
            'My.common.ui.DisplayMessage'
        ],
        items : [
            'unit-tests/UI-1_dialogBox.t.js'
        ]
    }
);
and also used the requires-array but have no success.

Is there a better way for testing package classes?

Post by nickolay »

Hi,

You'll need to compile scss to css to be able to load it. That is you need to build the app at least once, and then reference the created css bundles in the "preload".

Post Reply