Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1732,6 +1732,65 @@ class ActiveSupport::TestCase
end
end

it "creates node-renderer.js" do
assert_file "client/node-renderer.js" do |content|
expect(content).to include("reactOnRailsProNodeRenderer")
expect(content).to include("require('react-on-rails-pro-node-renderer')")
end
end

it "adds RSC bundle watcher to Procfile.dev" do
assert_file "Procfile.dev" do |content|
expect(content).to include("RSC_BUNDLE_ONLY=true")
expect(content).to include("rsc-bundle:")
expect(content).to include("bin/shakapacker-watch --watch")
end
end

it "creates HelloServer instead of HelloWorld" do
Comment thread
justin808 marked this conversation as resolved.
assert_no_file "app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx"
assert_no_file "app/javascript/src/HelloWorld/ror_components/HelloWorld.server.jsx"
assert_no_file "app/controllers/hello_world_controller.rb"
assert_file "config/routes.rb" do |content|
expect(content).not_to include("hello_world")
end

assert_file "app/javascript/src/HelloServer/ror_components/HelloServer.jsx"
assert_file "app/javascript/src/HelloServer/components/HelloServer.jsx"
assert_file "app/javascript/src/HelloServer/components/LikeButton.jsx"
end

it "adds HelloServer route and RSC payload route" do
Comment thread
justin808 marked this conversation as resolved.
assert_file "config/routes.rb" do |content|
expect(content).to include("hello_server")
expect(content).to include("rsc_payload")
end
end

it "creates rscWebpackConfig.js" do
assert_file "config/webpack/rscWebpackConfig.js" do |content|
expect(content).to include("const serverWebpackModule = require('./serverWebpackConfig')")
expect(content).to include("const serverWebpackConfig = serverWebpackModule.default || serverWebpackModule")
expect(content).to include("serverWebpackConfig(true)")
expect(content).to include("rsc-bundle")
expect(content).to include("react-server")
end
Comment thread
justin808 marked this conversation as resolved.
end
Comment thread
justin808 marked this conversation as resolved.
Comment thread
justin808 marked this conversation as resolved.
Comment thread
justin808 marked this conversation as resolved.
Comment thread
justin808 marked this conversation as resolved.
Comment thread
justin808 marked this conversation as resolved.

it "serverWebpackConfig includes RSCWebpackPlugin import" do
assert_file "config/webpack/serverWebpackConfig.js" do |content|
expect(content).to include("RSCWebpackPlugin")
expect(content).to include("react-on-rails-rsc/WebpackPlugin")
end
end

it "serverWebpackConfig has rscBundle parameter" do
assert_file "config/webpack/serverWebpackConfig.js" do |content|
expect(content).to match(/configureServer\s*=\s*\(rscBundle\s*=\s*false\)/)
expect(content).to include("if (!rscBundle)")
end
end
Comment thread
justin808 marked this conversation as resolved.
Comment thread
justin808 marked this conversation as resolved.

it "sets DEFAULT_ROUTE to hello_server in bin/dev" do
assert_file "bin/dev" do |content|
expect(content).to include('DEFAULT_ROUTE = "hello_server"')
Expand Down
Loading