@@ -79,6 +79,33 @@ test("Application: No replacement (No properties files)", async (t) => {
79
79
t . true ( t . context . logErrorSpy . notCalled , "No errors should be logged" ) ;
80
80
} ) ;
81
81
82
+ test ( "Application: Missing sap.app/id" , async ( t ) => {
83
+ const { manifestEnhancer, fs, createResource} = t . context ;
84
+
85
+ const input = JSON . stringify ( {
86
+ "_version" : "1.58.0" ,
87
+ "sap.app" : {
88
+ "type" : "application"
89
+ }
90
+ } , null , 2 ) ;
91
+
92
+ const resource = createResource ( "/resources/sap/ui/demo/app/manifest.json" , true , input ) ;
93
+
94
+ const processedResources = await manifestEnhancer ( {
95
+ resources : [ resource ] ,
96
+ fs
97
+ } ) ;
98
+
99
+ t . deepEqual ( processedResources , [ ] , "Only enhanced resources are returned" ) ;
100
+
101
+ t . is ( resource . setString . callCount , 0 , "setString should not be called" ) ;
102
+
103
+ t . is ( t . context . logVerboseSpy . callCount , 1 , "One verbose messages should be logged" ) ;
104
+ t . is ( t . context . logVerboseSpy . getCall ( 0 ) . args [ 0 ] ,
105
+ "/resources/sap/ui/demo/app/manifest.json: sap.app/id is not defined. No supportedLocales can be generated" ) ;
106
+ t . true ( t . context . logWarnSpy . notCalled , "No warnings should be logged" ) ;
107
+ t . true ( t . context . logErrorSpy . notCalled , "No errors should be logged" ) ;
108
+ } ) ;
82
109
83
110
test ( "Application: sap.app/i18n (without templates, default bundle): " +
84
111
"Adds supportedLocales based on available properties files" ,
@@ -1115,7 +1142,7 @@ test("Application: sap.ui5/models: Log verbose if manifest version is not define
1115
1142
1116
1143
t . is ( t . context . logVerboseSpy . callCount , 1 , "1 verbose should be logged" ) ;
1117
1144
t . is ( t . context . logVerboseSpy . getCall ( 0 ) . args [ 0 ] ,
1118
- "/resources/sap/ui/demo/app/manifest.json: _version is not defined. No supportedLocales are generated" ) ;
1145
+ "/resources/sap/ui/demo/app/manifest.json: _version is not defined. No supportedLocales can be generated" ) ;
1119
1146
t . true ( t . context . logWarnSpy . notCalled , "No warning should be logged" ) ;
1120
1147
t . true ( t . context . logErrorSpy . notCalled , "No errors should be logged" ) ;
1121
1148
t . is ( fs . readdir . callCount , 0 , "readdir should not be called because _version is not defined" ) ;
@@ -1722,6 +1749,72 @@ test("Library: No replacement at all", async (t) => {
1722
1749
t . true ( t . context . logErrorSpy . notCalled , "No errors should be logged" ) ;
1723
1750
} ) ;
1724
1751
1752
+ test ( "Library: Missing sap.app section" , async ( t ) => {
1753
+ const { manifestEnhancer, fs, createResource} = t . context ;
1754
+ const input = JSON . stringify ( {
1755
+ "_version" : "1.58.0" ,
1756
+ "sap.ui5" : {
1757
+ "library" : {
1758
+ "i18n" : {
1759
+ "bundleUrl" : "i18n.properties"
1760
+ }
1761
+ }
1762
+ }
1763
+ } , null , 2 ) ;
1764
+
1765
+ const resource = createResource ( "/resources/sap/ui/demo/lib/manifest.json" , true , input ) ;
1766
+
1767
+ const processedResources = await manifestEnhancer ( {
1768
+ resources : [ resource ] ,
1769
+ fs
1770
+ } ) ;
1771
+
1772
+ t . deepEqual ( processedResources , [ ] , "Only enhanced resources are returned" ) ;
1773
+
1774
+ t . is ( resource . setString . callCount , 0 , "setString should not be called" ) ;
1775
+
1776
+ t . is ( t . context . logVerboseSpy . callCount , 1 , "One verbose messages should be logged" ) ;
1777
+ t . is ( t . context . logVerboseSpy . getCall ( 0 ) . args [ 0 ] ,
1778
+ "/resources/sap/ui/demo/lib/manifest.json: sap.app/id is not defined. No supportedLocales can be generated" ) ;
1779
+ t . true ( t . context . logWarnSpy . notCalled , "No warnings should be logged" ) ;
1780
+ t . true ( t . context . logErrorSpy . notCalled , "No errors should be logged" ) ;
1781
+ } ) ;
1782
+
1783
+ test ( "Library: Missing sap.app/id" , async ( t ) => {
1784
+ const { manifestEnhancer, fs, createResource} = t . context ;
1785
+
1786
+ const input = JSON . stringify ( {
1787
+ "_version" : "1.58.0" ,
1788
+ "sap.app" : {
1789
+ "type" : "library"
1790
+ } ,
1791
+ "sap.ui5" : {
1792
+ "library" : {
1793
+ "i18n" : {
1794
+ "bundleUrl" : "i18n.properties"
1795
+ }
1796
+ }
1797
+ }
1798
+ } , null , 2 ) ;
1799
+
1800
+ const resource = createResource ( "/resources/sap/ui/demo/lib/manifest.json" , true , input ) ;
1801
+
1802
+ const processedResources = await manifestEnhancer ( {
1803
+ resources : [ resource ] ,
1804
+ fs
1805
+ } ) ;
1806
+
1807
+ t . deepEqual ( processedResources , [ ] , "Only enhanced resources are returned" ) ;
1808
+
1809
+ t . is ( resource . setString . callCount , 0 , "setString should not be called" ) ;
1810
+
1811
+ t . is ( t . context . logVerboseSpy . callCount , 1 , "One verbose messages should be logged" ) ;
1812
+ t . is ( t . context . logVerboseSpy . getCall ( 0 ) . args [ 0 ] ,
1813
+ "/resources/sap/ui/demo/lib/manifest.json: sap.app/id is not defined. No supportedLocales can be generated" ) ;
1814
+ t . true ( t . context . logWarnSpy . notCalled , "No warnings should be logged" ) ;
1815
+ t . true ( t . context . logErrorSpy . notCalled , "No errors should be logged" ) ;
1816
+ } ) ;
1817
+
1725
1818
test ( "Library: sap.app/i18n (with templates, no bundle defined): " +
1726
1819
"Does not add supportedLocales, as sap.app/i18n is not valid for libraries" ,
1727
1820
async ( t ) => {
0 commit comments