Skip to content

Commit

Permalink
Attempt e2e test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nephix committed Feb 19, 2020
1 parent 415929c commit 20717ea
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion raiden-ts/src/transport/epics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ function fetchSortedMatrixServers$(matrixServerLookup: string, httpTimeout: numb
toArray(),
mergeMap(rtts => sortBy(rtts, ['rtt'])),
filter(({ rtt }) => !isNaN(rtt)),
throwIfEmpty(() => new Error('Could not contact any matrix servers')),
throwIfEmpty(() => new RaidenError(ErrorCodes.TRNS_NO_MATRIX_SERVERS)),
);
}

Expand Down
1 change: 1 addition & 0 deletions raiden-ts/src/utils/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export enum ErrorCodes {
XFER_REFUNDED = 'Transfer has been refunded.',

// Transport errors
TRNS_NO_MATRIX_SERVERS = 'Could not contact any Matrix servers.',
TRNS_NO_VALID_USER = 'Could not find a user with a valid signature.',
TRNS_NO_SERVERNAME = 'Could not get server name from Matrix server.',
TRNS_NO_DISPLAYNAME = 'Could not get display name from Matrix server.',
Expand Down
6 changes: 3 additions & 3 deletions raiden-ts/tests/e2e/raiden.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ describe('Raiden', () => {

// token address not found as an account in provider
await expect(Raiden.create(provider, token, storage, contractsInfo, config)).rejects.toThrow(
/Account.*not found in provider/i,
ErrorCodes.RDN_ACCOUNT_NOT_FOUND,
);

// neither account index, address nor private key
await expect(
Raiden.create(provider, '0x1234', storage, contractsInfo, config),
).rejects.toThrow(/account must be either.*address or private key/i);
).rejects.toThrow(ErrorCodes.RDN_STRING_ACCOUNT_INVALID);

// from hex-encoded private key, initial unknown state (decodable) but invalid address inside
await expect(
Expand Down Expand Up @@ -803,7 +803,7 @@ describe('Raiden', () => {
expect.assertions(2);
raiden.updateConfig({ pfs: null });
await expect(raiden.transfer(token, partner, 201)).rejects.toThrowError(
/no direct route/i,
ErrorCodes.PFS_DISABLED,
);
});

Expand Down
3 changes: 2 additions & 1 deletion raiden-ts/tests/unit/epics/transport.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import { encodeJsonMessage, signMessage } from 'raiden-ts/messages/utils';
import { epicFixtures } from '../fixtures';
import { raidenEpicDeps } from '../mocks';
import { pluckDistinct } from 'raiden-ts/utils/rx';
import { ErrorCodes } from 'raiden-ts/utils/error';

describe('transport epic', () => {
let depsMock: ReturnType<typeof raidenEpicDeps>,
Expand Down Expand Up @@ -278,7 +279,7 @@ describe('transport epic', () => {
text: jest.fn(async () => ''),
});
await expect(initMatrixEpic(action$, state$, depsMock).toPromise()).rejects.toThrow(
'Could not contact any matrix servers',
ErrorCodes.TRNS_NO_MATRIX_SERVERS,
);
expect(fetch).toHaveBeenCalledTimes(2);
});
Expand Down

0 comments on commit 20717ea

Please sign in to comment.