Created
August 6, 2024 14:22
-
-
Save bstopp/f1f9fcdeefee94d9f1f451fa374f9273 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import assert from 'node:assert'; | |
import { Miniflare } from 'miniflare'; | |
describe('put copy', () => { | |
let mf; | |
let env; | |
beforeEach(async () => { | |
mf = new Miniflare({ | |
modules: true, | |
script: ` | |
export default { | |
async fetch(request, env, ctx) { | |
return new Response("Hello Miniflare!"); | |
} | |
} | |
`, | |
r2Buckets: { BUCKET: 'BUCKET' }, | |
}); | |
env = await mf.getBindings(); | |
}); | |
afterEach(async () => { | |
if (mf) await mf.dispose(); | |
}); | |
it ('should support R2ObjectBody ReadableStream for put', async () => { | |
const key = 'index.html'; | |
await env.BUCKET.put(key, 'Original Content'); | |
const current = await env.BUCKET.get(key); | |
const update = await env.BUCKET.put('other.html', current.body); | |
assert(update); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment