Skip to content

Commit

Permalink
rm unused imp
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-pousette committed Aug 15, 2022
1 parent 14b14b7 commit fd9f2af
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import BN from "bn.js";
import { write } from "fs";
import { BinaryReader } from "../binary";
import { BorshError } from "../error";
import {
Expand Down Expand Up @@ -269,7 +268,7 @@ describe("enum", () => {

test("empty", () => {
@variant(1)
class TestEnum {}
class TestEnum { }
const instance = new TestEnum();
validate(TestEnum);
const buf = serialize(instance);
Expand Down Expand Up @@ -299,7 +298,7 @@ describe("enum", () => {
});

test("enum field serialization/deserialization", () => {
class Super {}
class Super { }

@variant(0)
class Enum0 extends Super {
Expand Down Expand Up @@ -350,7 +349,7 @@ describe("enum", () => {
});

test("extended enum top variants", () => {
class SuperSuper {}
class SuperSuper { }

class Super extends SuperSuper {
constructor() {
Expand Down Expand Up @@ -399,7 +398,7 @@ describe("enum", () => {

test("extended enum inheritance variants", () => {
@variant(1)
class SuperSuper {}
class SuperSuper { }

@variant(2)
class Super extends SuperSuper {
Expand Down Expand Up @@ -449,7 +448,7 @@ describe("enum", () => {

test("extended enum inheritance variants, deserialization target does not matter", () => {
@variant(1)
class Super {}
class Super { }

@variant(2)
class Clazz extends Super {
Expand All @@ -475,7 +474,7 @@ describe("enum", () => {

test("extended enum inheritance variants, serialization target does matter for fields", () => {
@variant(0)
class Super {}
class Super { }

@variant(0)
class ClazzA extends Super {
Expand All @@ -493,7 +492,7 @@ describe("enum", () => {
class Struct {
@field({ type: ClazzA })
property: ClazzA;
constructor() {}
constructor() { }
}

const s = new Struct();
Expand All @@ -504,7 +503,7 @@ describe("enum", () => {

test("extended enum inheritance variants, deserialization target does matter for fields", () => {
@variant(0)
class Super {}
class Super { }

@variant(0)
class ClazzA extends Super {
Expand All @@ -522,7 +521,7 @@ describe("enum", () => {
class Struct {
@field({ type: ClazzB })
property: ClazzB;
constructor() {}
constructor() { }
}
// we try to deserializ [0,0] into Struct, which shouldnot be possible since property is instance of ClazzB
expect(() =>
Expand All @@ -532,7 +531,7 @@ describe("enum", () => {

test("extended enum inheritance and field value conflict is resolved", () => {
@variant(1)
class Super {}
class Super { }

@variant(2)
class Clazz extends Super {
Expand All @@ -559,7 +558,7 @@ describe("enum", () => {
});

test("inheritance without variant", () => {
class Super {}
class Super { }
class A extends Super {
@field({ type: "u8" })
public a: number;
Expand All @@ -585,7 +584,7 @@ describe("enum", () => {
}
}
@variant(1)
class C2 extends B {}
class C2 extends B { }

validate(Super);

Expand All @@ -604,7 +603,7 @@ describe("enum", () => {
});

test("wrapped enum", () => {
class Super {}
class Super { }

@variant(2)
class Enum2 extends Super {
Expand Down Expand Up @@ -642,7 +641,7 @@ describe("enum", () => {
});

test("enum variant array", () => {
class Super {}
class Super { }

@variant([1, 2, 3])
class Enum0 extends Super {
Expand Down Expand Up @@ -701,10 +700,10 @@ describe("enum", () => {
}

@variant("🦍")
class Gorilla extends Ape {}
class Gorilla extends Ape { }

@variant("🦧")
class Orangutan extends Ape {}
class Orangutan extends Ape { }

class HighCouncil {
@field({ type: vec(Ape) })
Expand Down Expand Up @@ -1033,7 +1032,7 @@ describe("Validation", () => {
test("variant conflict, index", () => {
const classDef = () => {
class TestStruct {
constructor() {}
constructor() { }
}
@variant(0) // Same as B
class A extends TestStruct {
Expand All @@ -1054,7 +1053,7 @@ describe("Validation", () => {

test("variant type conflict", () => {
class Super {
constructor() {}
constructor() { }
}
@variant([0, 0]) // Same as B
class A extends Super {
Expand All @@ -1073,9 +1072,9 @@ describe("Validation", () => {
});

test("variant type conflict inheritance", () => {
class SuperSuper {}
class SuperSuper { }

class Super extends SuperSuper {}
class Super extends SuperSuper { }

@variant([0, 0]) // Same as B
class A extends Super {
Expand All @@ -1094,7 +1093,7 @@ describe("Validation", () => {
});

test("variant type conflict array length", () => {
class Super {}
class Super { }

@variant([0, 0]) // Same as B
class A extends Super {
Expand All @@ -1114,7 +1113,7 @@ describe("Validation", () => {

test("error for non optimized code", () => {
class Super {
constructor() {}
constructor() { }
}

class A extends Super {
Expand Down Expand Up @@ -1151,14 +1150,14 @@ describe("Validation", () => {

test("valid dependency deep", () => {
class Super {
constructor() {}
constructor() { }
}

@variant(0)
class A extends Super {}
class A extends Super { }

@variant(1)
class B extends A {}
class B extends A { }

class Clazz {
@field({ type: Super })
Expand All @@ -1177,14 +1176,14 @@ describe("Validation", () => {

test("invalid dependency runtime", () => {
class Super {
constructor() {}
constructor() { }
}

@variant(0)
class A extends Super {}
class A extends Super { }

@variant(1)
class Other {}
class Other { }

class Clazz {
@field({ type: Super })
Expand All @@ -1201,7 +1200,7 @@ describe("Validation", () => {
});
test("error for non optimized code on deserialization", () => {
class TestStruct {
constructor() {}
constructor() { }
}

class A extends TestStruct {
Expand All @@ -1221,7 +1220,7 @@ describe("Validation", () => {
test("variant conflict, indices", () => {
const classDef = () => {
class TestStruct {
constructor() {}
constructor() { }
}
@variant([0, 1, 2]) // Same as B
class A extends TestStruct {
Expand Down

0 comments on commit fd9f2af

Please sign in to comment.