forked from reflex-dev/reflex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support setting Next.js basePath in Reflex config. (reflex-dev#1633)
- Tests. - And sorted config in next.config.js template.
- Loading branch information
Showing
5 changed files
with
136 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
module.exports = { | ||
reactStrictMode: true, | ||
basePath: "", | ||
compress: true, | ||
reactStrictMode: true, | ||
trailingSlash: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import pytest | ||
|
||
from reflex.config import Config | ||
from reflex.utils.prerequisites import update_next_config | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"template_next_config, reflex_config, expected_next_config", | ||
[ | ||
( | ||
""" | ||
module.exports = { | ||
basePath: "", | ||
compress: true, | ||
reactStrictMode: true, | ||
trailingSlash: true, | ||
}; | ||
""", | ||
Config( | ||
app_name="test", | ||
), | ||
""" | ||
module.exports = { | ||
basePath: "", | ||
compress: true, | ||
reactStrictMode: true, | ||
trailingSlash: true, | ||
}; | ||
""", | ||
), | ||
( | ||
""" | ||
module.exports = { | ||
basePath: "", | ||
compress: true, | ||
reactStrictMode: true, | ||
trailingSlash: true, | ||
}; | ||
""", | ||
Config( | ||
app_name="test", | ||
next_compression=False, | ||
), | ||
""" | ||
module.exports = { | ||
basePath: "", | ||
compress: false, | ||
reactStrictMode: true, | ||
trailingSlash: true, | ||
}; | ||
""", | ||
), | ||
( | ||
""" | ||
module.exports = { | ||
basePath: "", | ||
compress: true, | ||
reactStrictMode: true, | ||
trailingSlash: true, | ||
}; | ||
""", | ||
Config( | ||
app_name="test", | ||
frontend_path="/test", | ||
), | ||
""" | ||
module.exports = { | ||
basePath: "/test", | ||
compress: true, | ||
reactStrictMode: true, | ||
trailingSlash: true, | ||
}; | ||
""", | ||
), | ||
( | ||
""" | ||
module.exports = { | ||
basePath: "", | ||
compress: true, | ||
reactStrictMode: true, | ||
trailingSlash: true, | ||
}; | ||
""", | ||
Config( | ||
app_name="test", | ||
frontend_path="/test", | ||
next_compression=False, | ||
), | ||
""" | ||
module.exports = { | ||
basePath: "/test", | ||
compress: false, | ||
reactStrictMode: true, | ||
trailingSlash: true, | ||
}; | ||
""", | ||
), | ||
], | ||
) | ||
def test_update_next_config(template_next_config, reflex_config, expected_next_config): | ||
assert ( | ||
update_next_config(template_next_config, reflex_config) == expected_next_config | ||
) |