Skip to content

Commit

Permalink
LPS-199773 Fix testJSONUpgradeLiferayThemePackageJSONCheck - Change t…
Browse files Browse the repository at this point in the history
…he expected versions to a stable value
  • Loading branch information
nicolas-sss authored and brianchandotcom committed Oct 23, 2023
1 parent ff6ecb7 commit e8674be
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
*/
public class JSONUpgradeLiferayThemePackageJSONCheck extends BaseUpgradeCheck {

public static void setTestMode(boolean testMode) {
_testMode = testMode;
}

@Override
protected String format(
String fileName, String absolutePath, String content)
Expand Down Expand Up @@ -152,6 +156,11 @@ private Map<String, String> _getDevDependenciesLatestVersions() {

JSONObject jsonObject = new JSONObjectImpl(content);

if (_testMode) {
jsonObject = new JSONObjectImpl(
"{\"versions\":{\"2.0.0\":{}}}");
}

String latestVersion = _getLatestVersion(jsonObject);

if (latestVersion.equals("")) {
Expand Down Expand Up @@ -199,4 +208,6 @@ private String _getLatestVersion(JSONObject jsonObject) {
private static final Log _log = LogFactoryUtil.getLog(
JSONUpgradeLiferayThemePackageJSONCheck.class);

private static boolean _testMode;

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import com.liferay.petra.string.StringBundler;
import com.liferay.source.formatter.SourceFormatterArgs;
import com.liferay.source.formatter.check.JSONUpgradeLiferayThemePackageJSONCheck;
import com.liferay.source.formatter.check.UpgradeCatchAllCheck;

import java.util.ArrayList;
Expand All @@ -26,6 +27,8 @@ public void testGradleUpgradeReleaseDxpCheck() throws Exception {

@Test
public void testJSONUpgradeLiferayThemePackageJSONCheck() throws Exception {
JSONUpgradeLiferayThemePackageJSONCheck.setTestMode(true);

test(
"upgrade/json-upgrade-liferay-theme-package-json-check/package." +
"testjson");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"devDependencies": {
"compass-mixins": "0.12.12",
"gulp": "4.0.2",
"liferay-font-awesome": "3.5.2",
"liferay-frontend-css-common": "6.0.8",
"liferay-frontend-theme-styled": "6.0.68",
"liferay-frontend-theme-unstyled": "6.0.56",
"liferay-theme-tasks": "^11.5.3"
"compass-mixins": "2.0.0",
"gulp": "2.0.0",
"liferay-font-awesome": "2.0.0",
"liferay-frontend-css-common": "2.0.0",
"liferay-frontend-theme-styled": "2.0.0",
"liferay-frontend-theme-unstyled": "2.0.0",
"liferay-theme-tasks": "^2.0.0"
},
"liferayTheme": {
"version": "7.4"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"devDependencies": {
"gulp": "4.0.2",
"liferay-font-awesome": "3.4.1",
"liferay-frontend-css-common": "5.0.4",
"liferay-frontend-theme-styled": "4.0.10",
"liferay-theme-tasks": "^11.2.2"
"gulp": "2.0.0",
"liferay-font-awesome": "1.0.0",
"liferay-frontend-css-common": "1.0.0",
"liferay-frontend-theme-styled": "1.0.0",
"liferay-theme-tasks": "^1.0.0"
},
"liferayTheme": {
"version": "7.3"
Expand Down

0 comments on commit e8674be

Please sign in to comment.