Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
luu-alex committed Nov 6, 2023
1 parent 7b436a3 commit 99432fd
Showing 1 changed file with 24 additions and 49 deletions.
73 changes: 24 additions & 49 deletions packages/web3-validator/test/unit/load.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,57 +108,43 @@ describe('instance of validator', () => {
validator = new Web3Validator();
});

it('huge schema', async () => {
it('huge schema', () => {
let t = 0;
const pr = new Promise((resolve => {
expect(() => {
const t1 = Number(new Date());
validator.validateJSONSchema(hugeSchema, hugeData as object);
t = Number(new Date()) - t1;
}).not.toThrow();
expect(t).toBeLessThan(6000);
expect(t).toBeGreaterThan(0);
resolve("");
})
);
await pr;
expect(() => {
const t1 = Number(new Date());
validator.validateJSONSchema(hugeSchema, hugeData as object);
t = Number(new Date()) - t1;
}).not.toThrow();
expect(t).toBeLessThan(6000);
expect(t).toBeGreaterThan(0);
});

it('huge schema 1000', async () => {
it('huge schema 1000', () => {
let t = 0;
const pr = new Promise((resolve => {
expect(() => {
const t1 = Number(new Date());
validator.validateJSONSchema(hugeSchema1000, hugeData1000 as object);
t = Number(new Date()) - t1;
}).not.toThrow();
expect(t).toBeLessThan(6000);
expect(t).toBeGreaterThan(0);
resolve("")
}));
await pr;
})

it('simple schema multiple times', async () => {
expect(() => {
const t1 = Number(new Date());
validator.validateJSONSchema(hugeSchema1000, hugeData1000 as object);
t = Number(new Date()) - t1;
}).not.toThrow();
expect(t).toBeLessThan(6000);
expect(t).toBeGreaterThan(0);
});

it('simple schema multiple times', () => {
let t = 0;
const pr = new Promise((resolve => {
expect(() => {
const t1 = Number(new Date());
for (let i = 0; i < 500; i += 1) {
validator.validateJSONSchema(simpleSchema, simpleData as object);
}
t = Number(new Date()) - t1;
}).not.toThrow();
expect(t).toBeLessThan(4000);
expect(t).toBeLessThan(3000);
expect(t).toBeGreaterThan(0);
resolve("");
}));
await pr;
});

it('simple schema 1000 times', async () => {
it('simple schema 1000 times', () => {
let t = 0;
const pr = new Promise((resolve => {
expect(() => {
const t1 = Number(new Date());
for (let i = 0; i < 1000; i += 1) {
Expand All @@ -168,14 +154,10 @@ describe('instance of validator', () => {
}).not.toThrow();
expect(t).toBeLessThan(4000);
expect(t).toBeGreaterThan(0);
resolve("");
}));
await pr;
});

it('simple JSON schema 1000 times', async () => {
it('simple JSON schema 1000 times', () => {
let t = 0;
const pr = new Promise((resolve => {
expect(() => {
const t1 = Number(new Date());
for (let i = 0; i < 1000; i += 1) {
Expand All @@ -185,25 +167,18 @@ describe('instance of validator', () => {
}).not.toThrow();
expect(t).toBeLessThan(4000);
expect(t).toBeGreaterThan(0);
resolve("");
}));
await pr;
});

it('simple ABI 1000 times', async () => {
it('simple ABI 1000 times', () => {
let t = 0;
const pr = new Promise((resolve => {
expect(() => {
const t1 = Number(new Date());
for (let i = 0; i < 1000; i += 1) {
validator.validate(abi, abiData);
}
t = Number(new Date()) - t1;
}).not.toThrow();
expect(t).toBeLessThan(5000);
expect(t).toBeLessThan(4000);
expect(t).toBeGreaterThan(0);
resolve("");
}));
await pr;
});
});

0 comments on commit 99432fd

Please sign in to comment.