Skip to content

Commit 6b0a399

Browse files
committed
WIP
1 parent f2a7df3 commit 6b0a399

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed
File renamed without changes.

src/workerd/server/tests/extensions/extensions-test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import * as assert from 'node:assert'
22
import { openDoor } from 'test:module'
33

4+
// prettier-ignore
5+
const diff = (() => {const richTypes={Date:!0,RegExp:!0,String:!0,Number:!0};return function diff(e,t,r={cyclesFix:!0},a=[]){let c=[];var s=Array.isArray(e);for(const y in e){var p=e[y];const l=s?+y:y;if(y in t){var i=t[y],o="object"==typeof p&&"object"==typeof i;if(!(p&&i&&o)||richTypes[Object.getPrototypeOf(p)?.constructor?.name]||r.cyclesFix&&a.includes(p))p===i||o&&(isNaN(p)?p+""==i+"":+p==+i)||c.push({path:[l],type:"CHANGE",value:i,oldValue:p});else{const u=diff(p,i,r,r.cyclesFix?a.concat([p]):[]);c.push.apply(c,u.map(e=>(e.path.unshift(l),e)))}}else c.push({type:"REMOVE",path:[l],oldValue:e[y]})}var n=Array.isArray(t);for(const f in t)f in e||c.push({type:"CREATE",path:[n?+f:f],value:t[f]});return c}})();
6+
47
export const test_module_api = {
58
test() {
69
assert.throws(() => openDoor('test key'))
@@ -45,6 +48,8 @@ export const test_wrapped_binding = {
4548

4649
// NOTE: you need to be running `npx wrangler dev echoback.js` in another terminal
4750
// for this to pass (for now)...
48-
console.log(await env.d1.exec(`select 1`))
51+
assert.deepStrictEqual(await env.d1.prepare(`select 1`).all(), {
52+
lol: 'boats',
53+
})
4954
},
5055
}

src/workerd/server/tests/extensions/extensions-test.wd-test

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,21 @@ const unitTests :Workerd.Config = (
3333
moduleName = "cloudflare-internal:d1-api",
3434
innerBindings = [(
3535
name = "fetcher",
36-
service = "echoback"
36+
service = "d1-mock"
3737
)],
3838
)
3939
)
4040
],
4141
)
4242
),
43-
#( name = "d1_fetcher_1",
44-
# external = (
45-
# address = "localhost:8787",
46-
# http = (
47-
# injectRequestHeaders = [
48-
# ( name = "Authorization", value = "Bearer <redacted>" )
49-
# ]
50-
# )
51-
# )
52-
#),
53-
( name = "echoback",
43+
( name = "d1-mock",
5444
worker = (
5545
compatibilityDate = "2023-01-15",
5646
modules = [
57-
(name = "worker", esModule = embed "echoback.js")
47+
(name = "worker", esModule = embed "d1-mock.js")
5848
],
5949
)
6050
)
6151
],
62-
# sockets = [ ( name = "http", address = "*:3000", http = (), service = "echoback" ) ],
6352
extensions = [ TestExtension.extension ],
6453
);

0 commit comments

Comments
 (0)