![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/ |
/** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ 'underscore', 'uiRegistry', 'Magento_Ui/js/form/provider' ], function (_, registry, Constr) { 'use strict'; describe('Magento_Ui/js/form/provider', function () { var obj = new Constr({ provider: 'provName', name: '', index: '' }), originalClient = obj.client; registry.set('provName', { /** Stub */ on: function () {}, /** Stub */ get: function () {}, /** Stub */ set: function () {} }); describe('"initialize" method', function () { it('Check for defined ', function () { expect(obj.hasOwnProperty('initialize')).toBeDefined(); }); it('Check method type', function () { var type = typeof obj.initialize; expect(type).toEqual('function'); }); it('Check returned value if method called without arguments', function () { expect(obj.initialize()).toBeDefined(); }); it('Check returned value type if method called without arguments', function () { var type = typeof obj.initialize(); expect(type).toEqual('object'); }); }); describe('"initClient" method', function () { it('Check for defined ', function () { expect(obj.hasOwnProperty('initClient')).toBeDefined(); }); it('Check method type', function () { var type = typeof obj.initClient; expect(type).toEqual('function'); }); it('Check returned value if method called without arguments', function () { expect(obj.initClient()).toBeDefined(); }); it('Check returned value type if method called without arguments', function () { var type = typeof obj.initClient(); expect(type).toEqual('object'); }); it('Check returned value type if method called without arguments', function () { obj.client = null; expect(typeof obj.client).toEqual('object'); }); }); describe('"save" method', function () { it('Check for defined ', function () { expect(obj.hasOwnProperty('save')).toBeDefined(); }); it('Check method type', function () { var type = typeof obj.save; expect(type).toEqual('function'); }); it('Check returned value if method called without arguments', function () { obj.client = originalClient; obj.client.save = jasmine.createSpy(); expect(obj.save()).toBeDefined(); }); it('Check returned value type if method called without arguments', function () { var type = typeof obj.save(); expect(type).toEqual('object'); }); it('Check call method "this.get" inner save method', function () { obj.get = jasmine.createSpy(); obj.save(); expect(obj.get).toHaveBeenCalled(); }); it('Check call method "this.client.save" inner save method', function () { obj.get = jasmine.createSpy(); obj.save(); expect(obj.client.save).toHaveBeenCalled(); }); }); }); });