This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 69b61c528 fix(nodejs): test stat with version (#6307)
69b61c528 is described below
commit 69b61c52838f4661f6028b79e0a41c9e295c80de
Author: Kingsword <[email protected]>
AuthorDate: Wed Jun 18 00:22:20 2025 +0800
fix(nodejs): test stat with version (#6307)
---
.../nodejs/tests/suites/asyncStatOptions.suite.mjs | 35 +++++++++++-----------
.../nodejs/tests/suites/syncStatOptions.suite.mjs | 34 ++++++++++-----------
2 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/bindings/nodejs/tests/suites/asyncStatOptions.suite.mjs
b/bindings/nodejs/tests/suites/asyncStatOptions.suite.mjs
index f33d552e9..83384e121 100644
--- a/bindings/nodejs/tests/suites/asyncStatOptions.suite.mjs
+++ b/bindings/nodejs/tests/suites/asyncStatOptions.suite.mjs
@@ -131,29 +131,28 @@ export function run(op) {
await op.delete(filename)
})
- // Disable test until https://github.com/apache/opendal/issues/6305 fixed.
- // test.skipIf(!capability.statWithVersion)('stat with version', async ()
=> {
- // const size = 5 * 1024 * 1024
- // const filename = `random_file_${randomUUID()}`
- // const content = generateFixedBytes(size)
+ test.skipIf(!capability.statWithVersion)('stat with version', async () => {
+ const size = 5 * 1024 * 1024
+ const filename = `random_file_${randomUUID()}`
+ const content = generateFixedBytes(size)
- // await op.write(filename, content)
- // const first_meta = await op.stat(filename)
- // const first_version = first_meta.version
+ await op.write(filename, content)
+ const first_meta = await op.stat(filename)
+ const first_version = first_meta.version
- // const first_versioning_meta = await op.stat(filename, { version:
first_version })
- // expect(first_versioning_meta).toBe(first_meta)
+ const first_versioning_meta = await op.stat(filename, { version:
first_version })
+ expect(first_versioning_meta).toStrictEqual(first_meta)
- // await op.write(filename, content)
- // const second_meta = await op.stat(filename)
- // const second_version = second_meta.version
- // expect(second_version).not.toBe(first_version)
+ await op.write(filename, content)
+ const second_meta = await op.stat(filename)
+ const second_version = second_meta.version
+ expect(second_version).not.toBe(first_version)
- // const meta = await op.stat(filename, { version: first_version })
- // expect(meta).toBe(first_meta)
+ const meta = await op.stat(filename, { version: first_version })
+ expect(meta).toStrictEqual(first_meta)
- // await op.delete(filename)
- // })
+ await op.delete(filename)
+ })
test.skipIf(!capability.statWithVersion)('stat with not existing version',
async () => {
const size = 5 * 1024 * 1024
diff --git a/bindings/nodejs/tests/suites/syncStatOptions.suite.mjs
b/bindings/nodejs/tests/suites/syncStatOptions.suite.mjs
index 83b54e0df..eec57756d 100644
--- a/bindings/nodejs/tests/suites/syncStatOptions.suite.mjs
+++ b/bindings/nodejs/tests/suites/syncStatOptions.suite.mjs
@@ -128,28 +128,28 @@ export function run(op) {
}, 1000)
})
- // test.skipIf(!capability.statWithVersion)('stat with version', () => {
- // const size = 5 * 1024 * 1024
- // const filename = `random_file_${randomUUID()}`
- // const content = generateFixedBytes(size)
+ test.skipIf(!capability.statWithVersion)('stat with version', () => {
+ const size = 5 * 1024 * 1024
+ const filename = `random_file_${randomUUID()}`
+ const content = generateFixedBytes(size)
- // op.writeSync(filename, content)
- // const first_meta = op.statSync(filename)
- // const first_version = first_meta.version
+ op.writeSync(filename, content)
+ const first_meta = op.statSync(filename)
+ const first_version = first_meta.version
- // const first_versioning_meta = op.statSync(filename, { version:
first_version })
- // expect(first_versioning_meta).toBe(first_meta)
+ const first_versioning_meta = op.statSync(filename, { version:
first_version })
+ expect(first_versioning_meta).toStrictEqual(first_meta)
- // op.writeSync(filename, content)
- // const second_meta = op.statSync(filename)
- // const second_version = second_meta.version
- // expect(second_version).not.toBe(first_version)
+ op.writeSync(filename, content)
+ const second_meta = op.statSync(filename)
+ const second_version = second_meta.version
+ expect(second_version).not.toBe(first_version)
- // const meta = op.statSync(filename, { version: first_version })
- // expect(meta).toBe(first_meta)
+ const meta = op.statSync(filename, { version: first_version })
+ expect(meta).toStrictEqual(first_meta)
- // op.deleteSync(filename)
- // })
+ op.deleteSync(filename)
+ })
test.skipIf(!capability.statWithVersion)('stat with not existing version',
() => {
const size = 5 * 1024 * 1024