react-on-rails-pro-node-renderer 16.5.0 → 16.6.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -332,7 +332,7 @@ describe('worker', () => {
332
332
  protocolVersion,
333
333
  railsEnv,
334
334
  password: 'my_password',
335
- targetBundles: [bundleHash],
335
+ [`bundle_${bundleHash}`]: createReadStream(getFixtureBundle()),
336
336
  asset1: createReadStream(getFixtureAsset()),
337
337
  asset2: createReadStream(getOtherFixtureAsset()),
338
338
  });
@@ -342,6 +342,30 @@ describe('worker', () => {
342
342
  expect(fs.existsSync(assetPathOther(testName, bundleHash))).toBe(true);
343
343
  });
344
344
 
345
+ test('post /upload-assets ignores targetBundles when bundle_<hash> fields are present (backward compat)', async () => {
346
+ const bundleHash = 'compat-bundle-hash';
347
+
348
+ const app = worker({
349
+ serverBundleCachePath: serverBundleCachePathForTest(),
350
+ password: 'my_password',
351
+ });
352
+
353
+ // Simulates the Ruby client sending both bundle_<hash> (new) and targetBundles (legacy).
354
+ // The endpoint should derive targets from bundle_<hash> and ignore targetBundles.
355
+ const form = formAutoContent({
356
+ gemVersion,
357
+ protocolVersion,
358
+ railsEnv,
359
+ password: 'my_password',
360
+ [`bundle_${bundleHash}`]: createReadStream(getFixtureBundle()),
361
+ targetBundles: [bundleHash],
362
+ asset1: createReadStream(getFixtureAsset()),
363
+ });
364
+ const res = await app.inject().post(`/upload-assets`).payload(form.payload).headers(form.headers).end();
365
+ expect(res.statusCode).toBe(200);
366
+ expect(fs.existsSync(assetPath(testName, bundleHash))).toBe(true);
367
+ });
368
+
345
369
  test('post /upload-assets with multiple bundles and assets', async () => {
346
370
  const bundleHash = 'some-bundle-hash';
347
371
  const bundleHashOther = 'some-other-bundle-hash';
@@ -356,7 +380,8 @@ describe('worker', () => {
356
380
  protocolVersion,
357
381
  railsEnv,
358
382
  password: 'my_password',
359
- targetBundles: [bundleHash, bundleHashOther],
383
+ [`bundle_${bundleHash}`]: createReadStream(getFixtureBundle()),
384
+ [`bundle_${bundleHashOther}`]: createReadStream(getFixtureSecondaryBundle()),
360
385
  asset1: createReadStream(getFixtureAsset()),
361
386
  asset2: createReadStream(getOtherFixtureAsset()),
362
387
  });