From 2e56c547b6da9db08e73d8cf2f7d9778e3ba7181 Mon Sep 17 00:00:00 2001 From: LuizaMaluf Date: Fri, 17 Jan 2025 20:21:44 -0300 Subject: [PATCH 1/3] [test] - Using MC/DC no writing test of lookupComponent --- .../glimmer/tests/unit/resolver-test.js | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 packages/@ember/-internals/glimmer/tests/unit/resolver-test.js diff --git a/packages/@ember/-internals/glimmer/tests/unit/resolver-test.js b/packages/@ember/-internals/glimmer/tests/unit/resolver-test.js new file mode 100644 index 00000000000..5551b13a9da --- /dev/null +++ b/packages/@ember/-internals/glimmer/tests/unit/resolver-test.js @@ -0,0 +1,77 @@ +import QUnit from 'qunit'; +import { lookupComponentPair } from '@ember/-internals/glimmer/lib/resolver'; + +QUnit.module('lookupComponentPair - Linha 106', function(){ + QUnit.test('Test where isFactory is TRUE and component.class is TRUE', function(assert){ + let component = {isFactory: true, class: true}; + let layout = {someProperty: 'value'}; + + let result = lookupComponentPair(null, null, {component, layout}); + + assert.deepEqual(result, {component, layout}, 'Correct return when isFactory and component.class are TRUE.'); + }); + + QUnit.test('Test where isFactory is TRUE e component.class is FALSE', function(assert){ + let component = {isFactory: true, class: false}; + let layout = {someProperty: 'value'}; + + let result = lookupComponentPair(null, null, {component, layout}); + + assert.equal(result, null, 'Return null when isFactory is TRUE and component.class is FALSE'); + }); + + QUnit.test('Test where isFactory is FALSE and component.class is TRUE', function(assert){ + let component = {isFactory: false, class:true}; + let layout = {someProperty: 'value'}; + + let result = lookupComponentPair(null, null, {component, layout}); + + assert.equal(result, null, 'Return null when is Factory is FALSE and component.class is TRUE'); + }); + + QUnit.test('Test layout defined', function(assert){ + let component = {isFactory:true, class:true}; + let layout = {someProperty: 'value'}; + + let result = lookupComponentPair(null, null, {component, layout}); + + assert.deepEqual(result, {component, layout}, 'Return correct when layout is defined'); + }); + + QUnit.test('Test layout undefined', function(assert){ + let component = {isFactory:true, class: true}; + let layout = undefined; + + let result = lookupComponentPair(null, null, {component, layout}); + + assert.equal(result, null, 'Return null when layout is undefined'); + }); + + QUnit.test('Test of null component and null layout', function(assert){ + let component = null; + let layout = null; + + let result = lookupComponentPair(null, null, { component, layout }); + + assert.equal(result, null, 'Return null when component and layout are null'); + }) + + QUnit.test('Test of null component and not null layout', function(assert){ + let component = null; + let layout = { someProperty: 'value' }; + + let result = lookupComponentPair(null, null, { component, layout }); + + assert.deepEqual(result, {component:null, layout}, 'Return correct when component is null and not null layout'); + }); + + QUnit.test('Test of not null component and null layout',function(assert){ + let component = { isFactory: true, class: true }; + let layout = null; + + let result = lookupComponentPair(null, null, { component, layout }); + + assert.deepEqual(result, {component, layout:null}, 'Return correct when not null component and null layout'); + }); +}); + From c6b0a169616656565e5f81bb49e248642391f70d Mon Sep 17 00:00:00 2001 From: LuizaMaluf Date: Fri, 17 Jan 2025 20:27:34 -0300 Subject: [PATCH 2/3] [test] Using MC/DC no writing test of lookupComponent --- packages/@ember/-internals/glimmer/tests/unit/resolver-test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/@ember/-internals/glimmer/tests/unit/resolver-test.js b/packages/@ember/-internals/glimmer/tests/unit/resolver-test.js index 5551b13a9da..14da0b9e10f 100644 --- a/packages/@ember/-internals/glimmer/tests/unit/resolver-test.js +++ b/packages/@ember/-internals/glimmer/tests/unit/resolver-test.js @@ -75,3 +75,4 @@ QUnit.module('lookupComponentPair - Linha 106', function(){ }); }); + From 75c3c137a86dd8a5d1c88bb2e855b5a33b3cd7ad Mon Sep 17 00:00:00 2001 From: LuizaMaluf Date: Fri, 17 Jan 2025 20:30:31 -0300 Subject: [PATCH 3/3] [test] Using MC/DC no writing test of lookupComponent --- packages/@ember/-internals/glimmer/tests/unit/resolver-test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/@ember/-internals/glimmer/tests/unit/resolver-test.js b/packages/@ember/-internals/glimmer/tests/unit/resolver-test.js index 14da0b9e10f..c9027dec1fe 100644 --- a/packages/@ember/-internals/glimmer/tests/unit/resolver-test.js +++ b/packages/@ember/-internals/glimmer/tests/unit/resolver-test.js @@ -76,3 +76,4 @@ QUnit.module('lookupComponentPair - Linha 106', function(){ }); +