Skip to content

Commit

Permalink
test: remove unused common utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
RedYetiDev committed Sep 7, 2024
1 parent 18101d8 commit 7e2ade6
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 170 deletions.
31 changes: 0 additions & 31 deletions test/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -853,24 +853,6 @@ socket.write(frame.data);

The serialized `Buffer` may be retrieved using the `frame.data` property.

### Class: DataFrame extends Frame

The `http2.DataFrame` is a subclass of `http2.Frame` that serializes a `DATA`
frame.

<!-- eslint-disable no-undef, node-core/require-common-first, node-core/required-modules -->

```js
// id is the 32-bit stream identifier
// payload is a Buffer containing the DATA payload
// padlen is an 8-bit integer giving the number of padding bytes to include
// final is a boolean indicating whether the End-of-stream flag should be set,
// defaults to false.
const frame = new http2.DataFrame(id, payload, padlen, final);

socket.write(frame.data);
```

### Class: HeadersFrame

The `http2.HeadersFrame` is a subclass of `http2.Frame` that serializes a
Expand Down Expand Up @@ -1138,19 +1120,6 @@ are likely sufficient to hold a single file of `size` bytes. This is useful for
skipping tests that require hundreds of megabytes or even gigabytes of temporary
files, but it is inaccurate and susceptible to race conditions.

## UDP pair helper

The `common/udppair` module exports a function `makeUDPPair` and a class
`FakeUDPWrap`.

`FakeUDPWrap` emits `'send'` events when data is to be sent on it, and provides
an `emitReceived()` API for actin as if data has been received on it.

`makeUDPPair` returns an object `{ clientSide, serverSide }` where each side
is an `FakeUDPWrap` connected to the other side.

There is no difference between client or server side beyond their names.

## WPT module

### `harness`
Expand Down
18 changes: 0 additions & 18 deletions test/common/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,6 @@ const modp2buf = Buffer.from([
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
]);

function testDH({ publicKey: alicePublicKey, privateKey: alicePrivateKey },
{ publicKey: bobPublicKey, privateKey: bobPrivateKey },
expectedValue) {
const buf1 = crypto.diffieHellman({
privateKey: alicePrivateKey,
publicKey: bobPublicKey,
});
const buf2 = crypto.diffieHellman({
privateKey: bobPrivateKey,
publicKey: alicePublicKey,
});
assert.deepStrictEqual(buf1, buf2);

if (expectedValue !== undefined)
assert.deepStrictEqual(buf1, expectedValue);
}

// Asserts that the size of the given key (in chars or bytes) is within 10% of
// the expected size.
function assertApproximateSize(key, expectedSize) {
Expand Down Expand Up @@ -117,7 +100,6 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);

module.exports = {
modp2buf,
testDH,
assertApproximateSize,
testEncryptDecrypt,
testSignVerify,
Expand Down
19 changes: 0 additions & 19 deletions test/common/http2.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,6 @@ class SettingsFrame extends Frame {
}
}

class DataFrame extends Frame {
constructor(id, payload, padlen = 0, final = false) {
let len = payload.length;
let flags = 0;
if (final) flags |= FLAG_EOS;
const buffers = [payload];
if (padlen > 0) {
buffers.unshift(Buffer.from([padlen]));
buffers.push(PADDING.slice(0, padlen));
len += padlen + 1;
flags |= FLAG_PADDED;
}
super(len, 0, flags, id);
buffers.unshift(this[kFrameData]);
this[kFrameData] = Buffer.concat(buffers);
}
}

class HeadersFrame extends Frame {
constructor(id, payload, padlen = 0, final = false) {
let len = payload.length;
Expand Down Expand Up @@ -138,7 +120,6 @@ class AltSvcFrame extends Frame {
module.exports = {
Frame,
AltSvcFrame,
DataFrame,
HeadersFrame,
SettingsFrame,
PingFrame,
Expand Down
1 change: 0 additions & 1 deletion test/common/tick.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
'use strict';
require('../common');

module.exports = function tick(x, cb) {
function ontick() {
Expand Down
101 changes: 0 additions & 101 deletions test/common/udppair.js

This file was deleted.

0 comments on commit 7e2ade6

Please sign in to comment.