aurora-is-near / aurora-relayer

[DEPRECATED] Web3-compatible relayer server for Aurora.
https://aurora-is-near.github.io/aurora-relayer/
Creative Commons Zero v1.0 Universal
26 stars 13 forks source link

Fix jest specs #267

Closed zakerikk closed 2 years ago

zakerikk commented 2 years ago

Before:

FAIL  test/server.test.ts
  ● Test suite failed to run

    test/server.test.ts:4:10 - error TS2459: Module '"../lib/app.js"' declares 'Engine' locally, but it is not exported.

    4 import { Engine, createApp } from '../lib/app.js';
               ~~~~~~

      lib/app.d.ts:2:10
        2 import { Engine } from '@aurora-is-near/engine';
                   ~~~~~~
        'Engine' is declared here.

 FAIL  test/topics.test.ts
  ● [A] matches A in topics[0]

    expect(received).toEqual(expected) // deep equality

    Expected: "e.topics[0] = '\\xaa'"
    Received: "e.topics[1] = '\\xaa'"

      24 | test('[A] matches A in topics[0]', () => {
      25 |   const where = compileTopics([A]);
    > 26 |   expect(where!.toString()).toEqual("e.topics[0] = '\\xaa'");
         |                             ^
      27 | });
      28 |
      29 | test('[null, B] matches anything in topics[0] and B in topics[1]', () => {

      at Object.<anonymous> (test/topics.test.ts:26:29)

  ● [null, B] matches anything in topics[0] and B in topics[1]

    expect(received).toEqual(expected) // deep equality

    Expected: "e.topics[1] = '\\xbb'"
    Received: "e.topics[2] = '\\xbb'"

      29 | test('[null, B] matches anything in topics[0] and B in topics[1]', () => {
      30 |   const where = compileTopics([null, B]);
    > 31 |   expect(where!.toString()).toEqual("e.topics[1] = '\\xbb'");
         |                             ^
      32 | });
      33 |
      34 | test('[A, B] matches A in topics[0] and B in topics[1]', () => {

      at Object.<anonymous> (test/topics.test.ts:31:29)

  ● [A, B] matches A in topics[0] and B in topics[1]

    expect(received).toEqual(expected) // deep equality

    Expected: "(e.topics[0] = '\\xaa' AND e.topics[1] = '\\xbb')"
    Received: "(e.topics[1] = '\\xaa' AND e.topics[2] = '\\xbb')"

      34 | test('[A, B] matches A in topics[0] and B in topics[1]', () => {
      35 |   const where = compileTopics([A, B]);
    > 36 |   expect(where!.toString()).toEqual(
         |                             ^
      37 |     "(e.topics[0] = '\\xaa' AND e.topics[1] = '\\xbb')"
      38 |   );
      39 | });

      at Object.<anonymous> (test/topics.test.ts:36:29)

  ● [[A, B]] matches A or B in topics[0]

    expect(received).toEqual(expected) // deep equality

    Expected: "(e.topics[0] = '\\xaa' OR e.topics[0] = '\\xbb')"
    Received: "(e.topics[1] = '\\xaa' OR e.topics[1] = '\\xbb')"

      41 | test('[[A, B]] matches A or B in topics[0]', () => {
      42 |   const where = compileTopics([[A, B]]);
    > 43 |   expect(where!.toString()).toEqual(
         |                             ^
      44 |     "(e.topics[0] = '\\xaa' OR e.topics[0] = '\\xbb')"
      45 |   );
      46 | });

      at Object.<anonymous> (test/topics.test.ts:43:29)

  ● [[A, B], [A, B]] matches A or B in topics[0] and A or B in topics[1]

    expect(received).toEqual(expected) // deep equality

    Expected: "((e.topics[0] = '\\xaa' OR e.topics[0] = '\\xbb') AND (e.topics[1] = '\\xaa' OR e.topics[1] = '\\xbb'))"
    Received: "((e.topics[1] = '\\xaa' OR e.topics[1] = '\\xbb') AND (e.topics[2] = '\\xaa' OR e.topics[2] = '\\xbb'))"

      51 |     [A, B],
      52 |   ]);
    > 53 |   expect(where!.toString()).toEqual(
         |                             ^
      54 |     "((e.topics[0] = '\\xaa' OR e.topics[0] = '\\xbb') AND (e.topics[1] = '\\xaa' OR e.topics[1] = '\\xbb'))"
      55 |   );
      56 | });

      at Object.<anonymous> (test/topics.test.ts:53:29)

Test Suites: 2 failed, 2 total
Tests:       5 failed, 1 passed, 6 total
Snapshots:   0 total
Time:        1.83 s

After:

Test Suites: 2 passed, 2 total
Tests:       11 passed, 11 total
Snapshots:   0 total
Time:        18.706 s, estimated 20 s