mirror of
https://github.com/jwetzell/ddp-js.git
synced 2026-08-19 21:43:56 +00:00
npm run format:write
This commit is contained in:
@@ -97,12 +97,12 @@ export function decode(bytes: Uint8Array): DDPPacket {
|
|||||||
dataLength,
|
dataLength,
|
||||||
};
|
};
|
||||||
|
|
||||||
let dataStart = 10
|
let dataStart = 10;
|
||||||
if (flags.timecode) {
|
if (flags.timecode) {
|
||||||
if (bytes.length < 14) {
|
if (bytes.length < 14) {
|
||||||
throw new Error('DDP packet with timecode must be at least 14 bytes');
|
throw new Error('DDP packet with timecode must be at least 14 bytes');
|
||||||
}
|
}
|
||||||
dataStart = 14
|
dataStart = 14;
|
||||||
header.timecode = {
|
header.timecode = {
|
||||||
seconds: (bytes[10] << 8) + bytes[11],
|
seconds: (bytes[10] << 8) + bytes[11],
|
||||||
fractionalSeconds: (bytes[12] << 8) + bytes[13],
|
fractionalSeconds: (bytes[12] << 8) + bytes[13],
|
||||||
@@ -111,6 +111,6 @@ export function decode(bytes: Uint8Array): DDPPacket {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
header,
|
header,
|
||||||
data: bytes.subarray(dataStart)
|
data: bytes.subarray(dataStart),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ const goodTests = [
|
|||||||
dataOffset: 1164413200,
|
dataOffset: 1164413200,
|
||||||
dataLength: 4113,
|
dataLength: 4113,
|
||||||
},
|
},
|
||||||
data: new Uint8Array([])
|
data: new Uint8Array([]),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -56,8 +56,7 @@ const goodTests = [
|
|||||||
fractionalSeconds: 4368,
|
fractionalSeconds: 4368,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data: new Uint8Array([])
|
data: new Uint8Array([]),
|
||||||
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -2,13 +2,9 @@ const { deepEqual, throws } = require('assert');
|
|||||||
const { describe, it } = require('node:test');
|
const { describe, it } = require('node:test');
|
||||||
const ddp = require('../dist/cjs/index');
|
const ddp = require('../dist/cjs/index');
|
||||||
|
|
||||||
const goodTests = [
|
const goodTests = [];
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
const badTests = [
|
const badTests = [];
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
describe('DDP Message Encoding Pass', () => {
|
describe('DDP Message Encoding Pass', () => {
|
||||||
goodTests.forEach((messageTest) => {
|
goodTests.forEach((messageTest) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user