fix: add eslint-disable comments in Thrift tests
This commit is contained in:
parent
2cf80334b0
commit
2ebf46e6ca
@ -336,9 +336,11 @@ TestRegister.addApiTests([
|
|||||||
// ===== buildBinaryStruct tests =====
|
// ===== buildBinaryStruct tests =====
|
||||||
it("Thrift: buildBinaryStruct - simple struct", () => {
|
it("Thrift: buildBinaryStruct - simple struct", () => {
|
||||||
const bytes = [];
|
const bytes = [];
|
||||||
|
// eslint-disable camelcase
|
||||||
const jsonStruct = {
|
const jsonStruct = {
|
||||||
field_1: { type: "I32", value: 42 }
|
field_1: { type: "I32", value: 42 }
|
||||||
};
|
};
|
||||||
|
// eslint-enable camelcase
|
||||||
buildBinaryStruct(jsonStruct, bytes);
|
buildBinaryStruct(jsonStruct, bytes);
|
||||||
const expected = [
|
const expected = [
|
||||||
8, 0, 1, // field type (I32), field id = 1
|
8, 0, 1, // field type (I32), field id = 1
|
||||||
@ -350,10 +352,12 @@ TestRegister.addApiTests([
|
|||||||
|
|
||||||
it("Thrift: buildBinaryStruct - multiple fields", () => {
|
it("Thrift: buildBinaryStruct - multiple fields", () => {
|
||||||
const bytes = [];
|
const bytes = [];
|
||||||
|
// eslint-disable camelcase
|
||||||
const jsonStruct = {
|
const jsonStruct = {
|
||||||
field_1: { type: "I32", value: 42 },
|
field_1: { type: "I32", value: 42 },
|
||||||
field_2: { type: "BINARY", value: "hello" }
|
field_2: { type: "BINARY", value: "hello" }
|
||||||
};
|
};
|
||||||
|
// eslint-enable camelcase
|
||||||
buildBinaryStruct(jsonStruct, bytes);
|
buildBinaryStruct(jsonStruct, bytes);
|
||||||
// Should end with T_STOP
|
// Should end with T_STOP
|
||||||
assert.strictEqual(bytes[bytes.length - 1], 0);
|
assert.strictEqual(bytes[bytes.length - 1], 0);
|
||||||
@ -361,9 +365,11 @@ TestRegister.addApiTests([
|
|||||||
|
|
||||||
it("Thrift: buildBinaryStruct - BOOL field", () => {
|
it("Thrift: buildBinaryStruct - BOOL field", () => {
|
||||||
const bytes = [];
|
const bytes = [];
|
||||||
|
// eslint-disable camelcase
|
||||||
const jsonStruct = {
|
const jsonStruct = {
|
||||||
field_1: { type: "BOOL", value: true }
|
field_1: { type: "BOOL", value: true }
|
||||||
};
|
};
|
||||||
|
// eslint-enable camelcase
|
||||||
buildBinaryStruct(jsonStruct, bytes);
|
buildBinaryStruct(jsonStruct, bytes);
|
||||||
const expected = [
|
const expected = [
|
||||||
2, 0, 1, // field type (BOOL), field id = 1
|
2, 0, 1, // field type (BOOL), field id = 1
|
||||||
@ -375,6 +381,7 @@ TestRegister.addApiTests([
|
|||||||
|
|
||||||
it("Thrift: buildBinaryStruct - nested struct", () => {
|
it("Thrift: buildBinaryStruct - nested struct", () => {
|
||||||
const bytes = [];
|
const bytes = [];
|
||||||
|
// eslint-disable camelcase
|
||||||
const jsonStruct = {
|
const jsonStruct = {
|
||||||
field_1: {
|
field_1: {
|
||||||
type: "STRUCT",
|
type: "STRUCT",
|
||||||
@ -383,6 +390,7 @@ TestRegister.addApiTests([
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// eslint-enable camelcase
|
||||||
buildBinaryStruct(jsonStruct, bytes);
|
buildBinaryStruct(jsonStruct, bytes);
|
||||||
// Should contain nested structure with T_STOP markers
|
// Should contain nested structure with T_STOP markers
|
||||||
assert.ok(bytes.length > 0);
|
assert.ok(bytes.length > 0);
|
||||||
@ -391,10 +399,12 @@ TestRegister.addApiTests([
|
|||||||
|
|
||||||
it("Thrift: buildBinaryStruct - invalid field ID skipped", () => {
|
it("Thrift: buildBinaryStruct - invalid field ID skipped", () => {
|
||||||
const bytes = [];
|
const bytes = [];
|
||||||
|
// eslint-disable camelcase
|
||||||
const jsonStruct = {
|
const jsonStruct = {
|
||||||
invalid_field: { type: "I32", value: 42 },
|
invalid_field: { type: "I32", value: 42 },
|
||||||
field_1: { type: "I32", value: 10 }
|
field_1: { type: "I32", value: 10 }
|
||||||
};
|
};
|
||||||
|
// eslint-enable camelcase
|
||||||
buildBinaryStruct(jsonStruct, bytes);
|
buildBinaryStruct(jsonStruct, bytes);
|
||||||
// Should skip invalid_field and only process field_1
|
// Should skip invalid_field and only process field_1
|
||||||
assert.strictEqual(bytes[0], 8); // field type
|
assert.strictEqual(bytes[0], 8); // field type
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user