Skip to content

Commit 86352a5

Browse files
MC-30414: [2.4] Flaky Unit Test: Magento_Ui/js/form/form.encountered a declaration exception
1 parent 2d65f15 commit 86352a5

File tree

1 file changed

+40
-20
lines changed
  • dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form

1 file changed

+40
-20
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/form/form.test.js

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,50 @@
33
* See COPYING.txt for license details.
44
*/
55

6+
/**
7+
* Copyright © Magento, Inc. All rights reserved.
8+
* See COPYING.txt for license details.
9+
*/
10+
611
define([
7-
'underscore',
8-
'uiRegistry',
9-
'Magento_Ui/js/form/form'
10-
], function (_, registry, Constr) {
12+
'squire'
13+
], function (Squire) {
1114
'use strict';
1215

1316
describe('Magento_Ui/js/form/form', function () {
14-
15-
var obj = new Constr({
16-
provider: 'provName',
17-
name: '',
18-
index: ''
19-
});
20-
21-
registry.set('provName', {
22-
/** Stub */
23-
on: function () {},
24-
25-
/** Stub */
26-
get: function () {},
27-
28-
/** Stub */
29-
set: function () {}
17+
var injector = new Squire(),
18+
mocks = {
19+
'Magento_Ui/js/lib/registry/registry': {
20+
/** Method stub. */
21+
get: function () {
22+
return {
23+
get: jasmine.createSpy(),
24+
set: jasmine.createSpy()
25+
};
26+
},
27+
options: jasmine.createSpy(),
28+
create: jasmine.createSpy(),
29+
set: jasmine.createSpy(),
30+
async: jasmine.createSpy()
31+
}
32+
},
33+
obj,
34+
dataScope = 'dataScope';
35+
36+
beforeEach(function (done) {
37+
injector.mock(mocks);
38+
injector.require([
39+
'Magento_Ui/js/form/form'
40+
], function (Constr) {
41+
obj = new Constr({
42+
provider: 'provName',
43+
name: '',
44+
index: '',
45+
dataScope: dataScope
46+
});
47+
48+
done();
49+
});
3050
});
3151

3252
describe('"initAdapter" method', function () {

0 commit comments

Comments
 (0)