Non-Production Machines

    karma-extdirect-mock

    1.0.1 • Public • Published

    Sencha Ext.Direct mock for karma

    Compatibility:

    • Sencha Touch 2.3+
    • ExtJs 4.2.x+

    Installation

    The easiest way is to keep karma-extdirect-mock as a devDependency in your package.json.

    {
      "devDependencies": {
        "karma-extdirect-mock": "~1.0.1"
      }
    }

    You can simple do it by:

    npm install karma-extdirect-mock --save-dev

    Configuration

    // karma.conf.js 
    module.exports = function(config) {
        config.set({
            plugins: [
                'karma-extdirect-mock'
            ],
            frameworks: [
                'extdirectmock'
            ]
        });
    };

    Usage / Example code

    describe('Basic Assumptions: ', function() {
        it('Ext namespace should be available loaded', function() {
            expect(Ext).toBeDefined();
            expect(Ext.getVersion().major).toEqual(6);
        });
        it('Ext.direct mock should be available', function() {
            expect(extdirectmock).toBeDefined();
        });
        it('Ext.direct mock test call remote method', function() {
            extdirectmock.init({
                responseData: {
                    Math: {
                        sqrt: function(params) {
                            return Math.sqrt(params.text);
                        }
                    }
                }
            });
     
            Mock.api.Math.sqrt({
                text: 4
            }, function(response) {
                expect(response).toBe(2);
            });
        });
    });

    Install

    npm i karma-extdirect-mock

    DownloadsWeekly Downloads

    3

    Version

    1.0.1

    License

    BSD

    Last publish

    Collaborators

    • dec87