From 3fc37253daf13039436e5add11b902cee9716fa9 Mon Sep 17 00:00:00 2001 From: kptdobe Date: Mon, 17 Nov 2025 16:16:38 +0100 Subject: [PATCH 1/3] feat: get rid of the Collab Parse version --- src/storage/version/put.js | 9 +- test/storage/version/put.test.js | 275 +++++++++++++++++++++++++++++++ 2 files changed, 278 insertions(+), 6 deletions(-) diff --git a/src/storage/version/put.js b/src/storage/version/put.js index eee2b31..33c1351 100644 --- a/src/storage/version/put.js +++ b/src/storage/version/put.js @@ -112,12 +112,9 @@ export async function putObjectWithVersion(env, daCtx, update, body, guid) { } } - const pps = current.metadata?.preparsingstore || '0'; - - // Store the body if preparsingstore is not defined, so a once-off store - let storeBody = !body && pps === '0'; - const Preparsingstore = storeBody ? Timestamp : pps; - let Label = storeBody ? 'Collab Parse' : update.label; + const Preparsingstore = current.metadata?.preparsingstore || '0'; + let storeBody = false; + let Label = update.label; if (daCtx.method === 'PUT' && daCtx.ext === 'html' diff --git a/test/storage/version/put.test.js b/test/storage/version/put.test.js index b6fafcd..b8a6474 100644 --- a/test/storage/version/put.test.js +++ b/test/storage/version/put.test.js @@ -866,4 +866,279 @@ describe('Version Put', () => { assert.strictEqual(putCommand.input.Body, 'test body'); assert.strictEqual(putCommand.input.ContentLength, 9); }); + + it('Test NO Collab Parse version - preparsingstore behavior removed', async () => { + const sentCommands = []; + const mockS3Client = { + async send(cmd) { + sentCommands.push(cmd); + return { + $metadata: { httpStatusCode: 200 } + }; + } + }; + + const mockGetObject = async () => ({ + status: 200, + body: 'Existing content', + contentLength: 42, + contentType: 'text/html', + etag: 'existing-etag', + metadata: { + id: 'doc-123', + version: 'v1', + timestamp: '1234567890', + users: '[{"email":"user@example.com"}]', + path: 'docs/page.html', + preparsingstore: '0' // No longer triggers special behavior + } + }); + + const { putObjectWithVersion } = await esmock('../../../src/storage/version/put.js', { + '../../../src/storage/object/get.js': { + default: mockGetObject + }, + '../../../src/storage/utils/version.js': { + ifMatch: () => mockS3Client, + ifNoneMatch: () => mockS3Client, + }, + }); + + const env = {}; + const daCtx = { + org: 'test-org', + bucket: 'test-bucket', + key: 'docs/page.html', + ext: 'html', + method: 'PUT', + users: [{ email: 'user@example.com' }] + }; + + // Call without body parameter + await putObjectWithVersion(env, daCtx, { + bucket: 'test-bucket', + org: 'test-org', + key: 'docs/page.html', + type: 'text/html' + }); + + // Should have 2 commands: putVersion + putObject + assert.strictEqual(sentCommands.length, 2); + + // First command should be putVersion with empty body (no Collab Parse) + const versionCommand = sentCommands[0]; + assert.strictEqual(versionCommand.input.Key, 'test-org/.da-versions/doc-123/v1.html'); + assert.strictEqual(versionCommand.input.Body, ''); // Empty - no Collab Parse + assert.ok(versionCommand.input.ContentLength === undefined || versionCommand.input.ContentLength === 0); + + // Second command should be putObject updating the main file + const updateCommand = sentCommands[1]; + assert.strictEqual(updateCommand.input.Key, 'test-org/docs/page.html'); + // Preparsingstore should preserve the existing value + assert.strictEqual(updateCommand.input.Metadata.Preparsingstore, '0'); + }); + + it('Test preparsingstore defaults to 0 when undefined', async () => { + const sentCommands = []; + const mockS3Client = { + async send(cmd) { + sentCommands.push(cmd); + return { + $metadata: { httpStatusCode: 200 } + }; + } + }; + + const mockGetObject = async () => ({ + status: 200, + body: 'Existing content', + contentLength: 42, + contentType: 'text/html', + etag: 'existing-etag', + metadata: { + id: 'doc-456', + version: 'v2', + timestamp: '1234567890', + users: '[{"email":"user@example.com"}]', + path: 'docs/page2.html' + // preparsingstore is undefined - defaults to '0' + } + }); + + const { putObjectWithVersion } = await esmock('../../../src/storage/version/put.js', { + '../../../src/storage/object/get.js': { + default: mockGetObject + }, + '../../../src/storage/utils/version.js': { + ifMatch: () => mockS3Client, + ifNoneMatch: () => mockS3Client, + }, + }); + + const env = {}; + const daCtx = { + org: 'test-org', + bucket: 'test-bucket', + key: 'docs/page2.html', + ext: 'html', + method: 'PUT', + users: [{ email: 'user@example.com' }] + }; + + // Call without body parameter + await putObjectWithVersion(env, daCtx, { + bucket: 'test-bucket', + org: 'test-org', + key: 'docs/page2.html', + type: 'text/html' + }); + + // Should have 2 commands: putVersion + putObject + assert.strictEqual(sentCommands.length, 2); + + // First command should be putVersion with empty body + const versionCommand = sentCommands[0]; + assert.strictEqual(versionCommand.input.Key, 'test-org/.da-versions/doc-456/v2.html'); + assert.strictEqual(versionCommand.input.Body, ''); // Empty - no body stored + + // Second command - preparsingstore should default to '0' + const updateCommand = sentCommands[1]; + assert.strictEqual(updateCommand.input.Metadata.Preparsingstore, '0'); + }); + + it('Test preparsingstore preserves existing value when set', async () => { + const sentCommands = []; + const mockS3Client = { + async send(cmd) { + sentCommands.push(cmd); + return { + $metadata: { httpStatusCode: 200 } + }; + } + }; + + const mockGetObject = async () => ({ + status: 200, + body: 'Existing content', + contentLength: 42, + contentType: 'text/html', + etag: 'existing-etag', + metadata: { + id: 'doc-789', + version: 'v3', + timestamp: '1234567890', + users: '[{"email":"user@example.com"}]', + path: 'docs/page3.html', + preparsingstore: '1700000000000' // Already set - should be preserved + } + }); + + const { putObjectWithVersion } = await esmock('../../../src/storage/version/put.js', { + '../../../src/storage/object/get.js': { + default: mockGetObject + }, + '../../../src/storage/utils/version.js': { + ifMatch: () => mockS3Client, + ifNoneMatch: () => mockS3Client, + }, + }); + + const env = {}; + const daCtx = { + org: 'test-org', + bucket: 'test-bucket', + key: 'docs/page3.html', + ext: 'html', + method: 'PUT', + users: [{ email: 'user@example.com' }] + }; + + // Call without body parameter + await putObjectWithVersion(env, daCtx, { + bucket: 'test-bucket', + org: 'test-org', + key: 'docs/page3.html', + type: 'text/html' + }); + + // Should have 2 commands: putVersion (with empty body) + putObject + assert.strictEqual(sentCommands.length, 2); + + // First command should be putVersion with empty Body + const versionCommand = sentCommands[0]; + assert.strictEqual(versionCommand.input.Key, 'test-org/.da-versions/doc-789/v3.html'); + assert.strictEqual(versionCommand.input.Body, ''); // Empty - no body stored + // ContentLength can be undefined or 0 for empty body + assert.ok(versionCommand.input.ContentLength === undefined || versionCommand.input.ContentLength === 0); + + // Second command should preserve the existing preparsingstore value + const updateCommand = sentCommands[1]; + assert.strictEqual(updateCommand.input.Metadata.Preparsingstore, '1700000000000'); + }); + + it('Test version stores body when body parameter is provided', async () => { + const sentCommands = []; + const mockS3Client = { + async send(cmd) { + sentCommands.push(cmd); + return { + $metadata: { httpStatusCode: 200 } + }; + } + }; + + const mockGetObject = async () => ({ + status: 200, + body: 'Old content', + contentLength: 36, + contentType: 'text/html', + etag: 'existing-etag', + metadata: { + id: 'doc-abc', + version: 'v4', + timestamp: '1234567890', + users: '[{"email":"user@example.com"}]', + path: 'docs/page4.html', + preparsingstore: '0' + } + }); + + const { putObjectWithVersion } = await esmock('../../../src/storage/version/put.js', { + '../../../src/storage/object/get.js': { + default: mockGetObject + }, + '../../../src/storage/utils/version.js': { + ifMatch: () => mockS3Client, + ifNoneMatch: () => mockS3Client, + }, + }); + + const env = {}; + const daCtx = { + org: 'test-org', + bucket: 'test-bucket', + key: 'docs/page4.html', + ext: 'html', + method: 'PUT', + users: [{ email: 'user@example.com' }] + }; + + // Call WITH body parameter + await putObjectWithVersion(env, daCtx, { + bucket: 'test-bucket', + org: 'test-org', + key: 'docs/page4.html', + body: 'New content', + type: 'text/html' + }, true); // body parameter is true + + // Should have 2 commands: putVersion + putObject + assert.strictEqual(sentCommands.length, 2); + + // First command should be putVersion with the OLD body content + const versionCommand = sentCommands[0]; + assert.strictEqual(versionCommand.input.Key, 'test-org/.da-versions/doc-abc/v4.html'); + assert.strictEqual(versionCommand.input.Body, 'Old content'); + assert.strictEqual(versionCommand.input.ContentLength, 36); + }); }); From bb0eea231114f3e833ffa851bfeecae258c53fd6 Mon Sep 17 00:00:00 2001 From: kptdobe Date: Wed, 3 Dec 2025 16:25:07 +0100 Subject: [PATCH 2/3] chore: linting --- test/storage/version/put.test.js | 72 +++++++++++++++++--------------- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/test/storage/version/put.test.js b/test/storage/version/put.test.js index 940636f..b923f6e 100644 --- a/test/storage/version/put.test.js +++ b/test/storage/version/put.test.js @@ -879,9 +879,9 @@ describe('Version Put', () => { async send(cmd) { sentCommands.push(cmd); return { - $metadata: { httpStatusCode: 200 } + $metadata: { httpStatusCode: 200 }, }; - } + }, }; const mockGetObject = async () => ({ @@ -896,13 +896,13 @@ describe('Version Put', () => { timestamp: '1234567890', users: '[{"email":"user@example.com"}]', path: 'docs/page.html', - preparsingstore: '0' // No longer triggers special behavior - } + preparsingstore: '0', // No longer triggers special behavior + }, }); const { putObjectWithVersion } = await esmock('../../../src/storage/version/put.js', { '../../../src/storage/object/get.js': { - default: mockGetObject + default: mockGetObject, }, '../../../src/storage/utils/version.js': { ifMatch: () => mockS3Client, @@ -917,7 +917,7 @@ describe('Version Put', () => { key: 'docs/page.html', ext: 'html', method: 'PUT', - users: [{ email: 'user@example.com' }] + users: [{ email: 'user@example.com' }], }; // Call without body parameter @@ -925,7 +925,7 @@ describe('Version Put', () => { bucket: 'test-bucket', org: 'test-org', key: 'docs/page.html', - type: 'text/html' + type: 'text/html', }); // Should have 2 commands: putVersion + putObject @@ -935,8 +935,11 @@ describe('Version Put', () => { const versionCommand = sentCommands[0]; assert.strictEqual(versionCommand.input.Key, 'test-org/.da-versions/doc-123/v1.html'); assert.strictEqual(versionCommand.input.Body, ''); // Empty - no Collab Parse - assert.ok(versionCommand.input.ContentLength === undefined || versionCommand.input.ContentLength === 0); - + assert.ok( + versionCommand.input.ContentLength === undefined + || versionCommand.input.ContentLength === 0, + ); + // Second command should be putObject updating the main file const updateCommand = sentCommands[1]; assert.strictEqual(updateCommand.input.Key, 'test-org/docs/page.html'); @@ -950,9 +953,9 @@ describe('Version Put', () => { async send(cmd) { sentCommands.push(cmd); return { - $metadata: { httpStatusCode: 200 } + $metadata: { httpStatusCode: 200 }, }; - } + }, }; const mockGetObject = async () => ({ @@ -966,14 +969,14 @@ describe('Version Put', () => { version: 'v2', timestamp: '1234567890', users: '[{"email":"user@example.com"}]', - path: 'docs/page2.html' + path: 'docs/page2.html', // preparsingstore is undefined - defaults to '0' - } + }, }); const { putObjectWithVersion } = await esmock('../../../src/storage/version/put.js', { '../../../src/storage/object/get.js': { - default: mockGetObject + default: mockGetObject, }, '../../../src/storage/utils/version.js': { ifMatch: () => mockS3Client, @@ -988,7 +991,7 @@ describe('Version Put', () => { key: 'docs/page2.html', ext: 'html', method: 'PUT', - users: [{ email: 'user@example.com' }] + users: [{ email: 'user@example.com' }], }; // Call without body parameter @@ -996,7 +999,7 @@ describe('Version Put', () => { bucket: 'test-bucket', org: 'test-org', key: 'docs/page2.html', - type: 'text/html' + type: 'text/html', }); // Should have 2 commands: putVersion + putObject @@ -1006,7 +1009,7 @@ describe('Version Put', () => { const versionCommand = sentCommands[0]; assert.strictEqual(versionCommand.input.Key, 'test-org/.da-versions/doc-456/v2.html'); assert.strictEqual(versionCommand.input.Body, ''); // Empty - no body stored - + // Second command - preparsingstore should default to '0' const updateCommand = sentCommands[1]; assert.strictEqual(updateCommand.input.Metadata.Preparsingstore, '0'); @@ -1018,9 +1021,9 @@ describe('Version Put', () => { async send(cmd) { sentCommands.push(cmd); return { - $metadata: { httpStatusCode: 200 } + $metadata: { httpStatusCode: 200 }, }; - } + }, }; const mockGetObject = async () => ({ @@ -1035,13 +1038,13 @@ describe('Version Put', () => { timestamp: '1234567890', users: '[{"email":"user@example.com"}]', path: 'docs/page3.html', - preparsingstore: '1700000000000' // Already set - should be preserved - } + preparsingstore: '1700000000000', // Already set - should be preserved + }, }); const { putObjectWithVersion } = await esmock('../../../src/storage/version/put.js', { '../../../src/storage/object/get.js': { - default: mockGetObject + default: mockGetObject, }, '../../../src/storage/utils/version.js': { ifMatch: () => mockS3Client, @@ -1056,7 +1059,7 @@ describe('Version Put', () => { key: 'docs/page3.html', ext: 'html', method: 'PUT', - users: [{ email: 'user@example.com' }] + users: [{ email: 'user@example.com' }], }; // Call without body parameter @@ -1064,7 +1067,7 @@ describe('Version Put', () => { bucket: 'test-bucket', org: 'test-org', key: 'docs/page3.html', - type: 'text/html' + type: 'text/html', }); // Should have 2 commands: putVersion (with empty body) + putObject @@ -1075,8 +1078,11 @@ describe('Version Put', () => { assert.strictEqual(versionCommand.input.Key, 'test-org/.da-versions/doc-789/v3.html'); assert.strictEqual(versionCommand.input.Body, ''); // Empty - no body stored // ContentLength can be undefined or 0 for empty body - assert.ok(versionCommand.input.ContentLength === undefined || versionCommand.input.ContentLength === 0); - + assert.ok( + versionCommand.input.ContentLength === undefined + || versionCommand.input.ContentLength === 0, + ); + // Second command should preserve the existing preparsingstore value const updateCommand = sentCommands[1]; assert.strictEqual(updateCommand.input.Metadata.Preparsingstore, '1700000000000'); @@ -1088,9 +1094,9 @@ describe('Version Put', () => { async send(cmd) { sentCommands.push(cmd); return { - $metadata: { httpStatusCode: 200 } + $metadata: { httpStatusCode: 200 }, }; - } + }, }; const mockGetObject = async () => ({ @@ -1105,13 +1111,13 @@ describe('Version Put', () => { timestamp: '1234567890', users: '[{"email":"user@example.com"}]', path: 'docs/page4.html', - preparsingstore: '0' - } + preparsingstore: '0', + }, }); const { putObjectWithVersion } = await esmock('../../../src/storage/version/put.js', { '../../../src/storage/object/get.js': { - default: mockGetObject + default: mockGetObject, }, '../../../src/storage/utils/version.js': { ifMatch: () => mockS3Client, @@ -1126,7 +1132,7 @@ describe('Version Put', () => { key: 'docs/page4.html', ext: 'html', method: 'PUT', - users: [{ email: 'user@example.com' }] + users: [{ email: 'user@example.com' }], }; // Call WITH body parameter @@ -1135,7 +1141,7 @@ describe('Version Put', () => { org: 'test-org', key: 'docs/page4.html', body: 'New content', - type: 'text/html' + type: 'text/html', }, true); // body parameter is true // Should have 2 commands: putVersion + putObject From fd9bbffddd9618bb0ec639e8104bc67ca55a14fd Mon Sep 17 00:00:00 2001 From: kptdobe Date: Wed, 3 Dec 2025 16:44:26 +0100 Subject: [PATCH 3/3] chore: get rid of pps --- src/storage/version/put.js | 5 +- test/storage/version/put.test.js | 223 +------------------------------ 2 files changed, 3 insertions(+), 225 deletions(-) diff --git a/src/storage/version/put.js b/src/storage/version/put.js index 685675a..0d6bf29 100644 --- a/src/storage/version/put.js +++ b/src/storage/version/put.js @@ -179,7 +179,6 @@ export async function putObjectWithVersion( } } - let pps = current.metadata?.preparsingstore || '0'; let storeBody = false; let Label = update.label; @@ -195,7 +194,6 @@ export async function putObjectWithVersion( console.warn(`Empty body, creating a restore point (${current.contentLength} / ${update.body?.size})`); storeBody = true; Label = 'Restore Point'; - pps = Timestamp; } const versionResp = await putVersion(config, { @@ -221,8 +219,9 @@ export async function putObjectWithVersion( } const metadata = { - ID, Users, Timestamp, Path, Preparsingstore: pps, + ID, Users, Timestamp, Path, }; + // Only include Version metadata for files that support versioning if (createVersion) { metadata.Version = crypto.randomUUID(); diff --git a/test/storage/version/put.test.js b/test/storage/version/put.test.js index 0b2a70f..9d69354 100644 --- a/test/storage/version/put.test.js +++ b/test/storage/version/put.test.js @@ -300,7 +300,6 @@ describe('Version Put', () => { contentType: 'text/html', metadata: { id: 'q123-456', - preparsingstore: Date.now(), version: 'ver123', }, status: 201, @@ -363,7 +362,6 @@ describe('Version Put', () => { assert.equal('[{"email":"foo@acme.org"},{"email":"bar@acme.org"}]', s3Sent[0].input.Metadata.Users); assert.notEqual('aaa-bbb', s3Sent[0].input.Metadata.Version); assert(s3Sent[0].input.Metadata.Timestamp > 0); - assert((s3Sent[0].input.Metadata.Preparsingstore - s3Sent[0].input.Metadata.Timestamp) < 100); }); it('Put First Object With Version', async () => { @@ -556,7 +554,6 @@ describe('Version Put', () => { path: '/q', timestamp: 123, users: '[{"email":"anonymous"}]', - preparsingstore: 12345, }; return { body: '', metadata, contentLength: 616 }; }; @@ -886,221 +883,6 @@ describe('Version Put', () => { assert.strictEqual(putCommand.input.ContentLength, 9); }); - it('Test NO Collab Parse version - preparsingstore behavior removed', async () => { - const sentCommands = []; - const mockS3Client = { - async send(cmd) { - sentCommands.push(cmd); - return { - $metadata: { httpStatusCode: 200 }, - }; - }, - }; - - const mockGetObject = async () => ({ - status: 200, - body: 'Existing content', - contentLength: 42, - contentType: 'text/html', - etag: 'existing-etag', - metadata: { - id: 'doc-123', - version: 'v1', - timestamp: '1234567890', - users: '[{"email":"user@example.com"}]', - path: 'docs/page.html', - preparsingstore: '0', // No longer triggers special behavior - }, - }); - - const { putObjectWithVersion } = await esmock('../../../src/storage/version/put.js', { - '../../../src/storage/object/get.js': { - default: mockGetObject, - }, - '../../../src/storage/utils/version.js': { - ifMatch: () => mockS3Client, - ifNoneMatch: () => mockS3Client, - }, - }); - - const env = {}; - const daCtx = { - org: 'test-org', - bucket: 'test-bucket', - key: 'docs/page.html', - ext: 'html', - method: 'PUT', - users: [{ email: 'user@example.com' }], - }; - - // Call without body parameter - await putObjectWithVersion(env, daCtx, { - bucket: 'test-bucket', - org: 'test-org', - key: 'docs/page.html', - type: 'text/html', - }); - - // Should have 2 commands: putVersion + putObject - assert.strictEqual(sentCommands.length, 2); - - // First command should be putVersion with empty body (no Collab Parse) - const versionCommand = sentCommands[0]; - assert.strictEqual(versionCommand.input.Key, 'test-org/.da-versions/doc-123/v1.html'); - assert.strictEqual(versionCommand.input.Body, ''); // Empty - no Collab Parse - assert.ok( - versionCommand.input.ContentLength === undefined - || versionCommand.input.ContentLength === 0, - ); - - // Second command should be putObject updating the main file - const updateCommand = sentCommands[1]; - assert.strictEqual(updateCommand.input.Key, 'test-org/docs/page.html'); - // Preparsingstore should preserve the existing value - assert.strictEqual(updateCommand.input.Metadata.Preparsingstore, '0'); - }); - - it('Test preparsingstore defaults to 0 when undefined', async () => { - const sentCommands = []; - const mockS3Client = { - async send(cmd) { - sentCommands.push(cmd); - return { - $metadata: { httpStatusCode: 200 }, - }; - }, - }; - - const mockGetObject = async () => ({ - status: 200, - body: 'Existing content', - contentLength: 42, - contentType: 'text/html', - etag: 'existing-etag', - metadata: { - id: 'doc-456', - version: 'v2', - timestamp: '1234567890', - users: '[{"email":"user@example.com"}]', - path: 'docs/page2.html', - // preparsingstore is undefined - defaults to '0' - }, - }); - - const { putObjectWithVersion } = await esmock('../../../src/storage/version/put.js', { - '../../../src/storage/object/get.js': { - default: mockGetObject, - }, - '../../../src/storage/utils/version.js': { - ifMatch: () => mockS3Client, - ifNoneMatch: () => mockS3Client, - }, - }); - - const env = {}; - const daCtx = { - org: 'test-org', - bucket: 'test-bucket', - key: 'docs/page2.html', - ext: 'html', - method: 'PUT', - users: [{ email: 'user@example.com' }], - }; - - // Call without body parameter - await putObjectWithVersion(env, daCtx, { - bucket: 'test-bucket', - org: 'test-org', - key: 'docs/page2.html', - type: 'text/html', - }); - - // Should have 2 commands: putVersion + putObject - assert.strictEqual(sentCommands.length, 2); - - // First command should be putVersion with empty body - const versionCommand = sentCommands[0]; - assert.strictEqual(versionCommand.input.Key, 'test-org/.da-versions/doc-456/v2.html'); - assert.strictEqual(versionCommand.input.Body, ''); // Empty - no body stored - - // Second command - preparsingstore should default to '0' - const updateCommand = sentCommands[1]; - assert.strictEqual(updateCommand.input.Metadata.Preparsingstore, '0'); - }); - - it('Test preparsingstore preserves existing value when set', async () => { - const sentCommands = []; - const mockS3Client = { - async send(cmd) { - sentCommands.push(cmd); - return { - $metadata: { httpStatusCode: 200 }, - }; - }, - }; - - const mockGetObject = async () => ({ - status: 200, - body: 'Existing content', - contentLength: 42, - contentType: 'text/html', - etag: 'existing-etag', - metadata: { - id: 'doc-789', - version: 'v3', - timestamp: '1234567890', - users: '[{"email":"user@example.com"}]', - path: 'docs/page3.html', - preparsingstore: '1700000000000', // Already set - should be preserved - }, - }); - - const { putObjectWithVersion } = await esmock('../../../src/storage/version/put.js', { - '../../../src/storage/object/get.js': { - default: mockGetObject, - }, - '../../../src/storage/utils/version.js': { - ifMatch: () => mockS3Client, - ifNoneMatch: () => mockS3Client, - }, - }); - - const env = {}; - const daCtx = { - org: 'test-org', - bucket: 'test-bucket', - key: 'docs/page3.html', - ext: 'html', - method: 'PUT', - users: [{ email: 'user@example.com' }], - }; - - // Call without body parameter - await putObjectWithVersion(env, daCtx, { - bucket: 'test-bucket', - org: 'test-org', - key: 'docs/page3.html', - type: 'text/html', - }); - - // Should have 2 commands: putVersion (with empty body) + putObject - assert.strictEqual(sentCommands.length, 2); - - // First command should be putVersion with empty Body - const versionCommand = sentCommands[0]; - assert.strictEqual(versionCommand.input.Key, 'test-org/.da-versions/doc-789/v3.html'); - assert.strictEqual(versionCommand.input.Body, ''); // Empty - no body stored - // ContentLength can be undefined or 0 for empty body - assert.ok( - versionCommand.input.ContentLength === undefined - || versionCommand.input.ContentLength === 0, - ); - - // Second command should preserve the existing preparsingstore value - const updateCommand = sentCommands[1]; - assert.strictEqual(updateCommand.input.Metadata.Preparsingstore, '1700000000000'); - }); - it('Test version stores body when body parameter is provided', async () => { const sentCommands = []; const mockS3Client = { @@ -1124,7 +906,6 @@ describe('Version Put', () => { timestamp: '1234567890', users: '[{"email":"user@example.com"}]', path: 'docs/page4.html', - preparsingstore: '0', }, }); @@ -2376,6 +2157,4 @@ describe('Version Put', () => { assert.strictEqual(sentCommands.length, 1); }); }); - - -}); \ No newline at end of file +});