Skip to content

Commit

Permalink
WIP disable pre_tunnel_to
Browse files Browse the repository at this point in the history
  • Loading branch information
imcotton committed Oct 31, 2022
1 parent 9d03942 commit ddfa499
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions mod.test.ts
@@ -1,7 +1,7 @@
import * as ast from 'https://deno.land/std@0.160.0/testing/asserts.ts';
import * as mock from 'https://deno.land/std@0.160.0/testing/mock.ts';

import { concat, repeat } from 'https://deno.land/std@0.160.0/bytes/mod.ts';
import { repeat } from 'https://deno.land/std@0.160.0/bytes/mod.ts';
import { delay, DeadlineError } from 'https://deno.land/std@0.160.0/async/mod.ts';
import { copy } from 'https://deno.land/std@0.160.0/streams/conversion.ts';
import { sample } from 'https://deno.land/std@0.160.0/collections/sample.ts';
Expand All @@ -16,7 +16,7 @@ import {
import {

type Opts,
type Conn,
// type Conn,

port_normalize,
port_verify,
Expand All @@ -25,7 +25,7 @@ import {
pre_serves,
ignores,
pre_on_request,
pre_tunnel_to,
// pre_tunnel_to,
main,
try_catch,
catch_abortable,
Expand Down Expand Up @@ -658,7 +658,8 @@ Deno.test('catch_abortable', async () => {



Deno.test('pre_tunnel_to', async () => {
/*
Deno.test('pre_tunnel_to', { only: true }, async () => {
class Duplex implements Conn {
Expand Down Expand Up @@ -716,11 +717,17 @@ Deno.test('pre_tunnel_to', async () => {
const port = 8080;
const hostname = 'localhost';
const established = new Response(null, { status: 200 });
const head = Uint8Array.of(0);
const body = Uint8Array.from([ 1, 2, 3 ]);
{ // succeeded with no error
const respondWith = mock.spy((res: Response) => Promise.resolve(
ast.assertNotStrictEquals(res.status, 200),
));
const req = new Duplex(body);
const res = new Duplex(body);
Expand All @@ -731,10 +738,10 @@ Deno.test('pre_tunnel_to', async () => {
});
const tunnel = pre_tunnel_to({
head,
error,
connect,
ignoring: _ => false,
established,
error,
});
await tunnel (port, hostname) (res);
Expand All @@ -760,10 +767,10 @@ Deno.test('pre_tunnel_to', async () => {
const error = mock.spy(() => { });
const tunnel = pre_tunnel_to({
head,
error,
connect: _ => Promise.resolve(req),
ignoring: _ => false,
established,
error,
});
await tunnel (port, hostname) (res);
Expand All @@ -783,10 +790,10 @@ Deno.test('pre_tunnel_to', async () => {
const { signal } = ctrl;
const tunnel = pre_tunnel_to({
head,
error,
connect: _ => delay(500, { signal }).then(() => req),
ignoring: _ => false,
established,
error,
});
await tunnel (port, hostname) (res, 20);
Expand All @@ -798,4 +805,5 @@ Deno.test('pre_tunnel_to', async () => {
}
});
*/

0 comments on commit ddfa499

Please sign in to comment.