Skip to content

Commit

Permalink
fix MultichainMiddlewareManager spec and scenario names
Browse files Browse the repository at this point in the history
  • Loading branch information
jiexi committed Jan 17, 2025
1 parent af0d8c7 commit 237eb59
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('MultichainMiddlewareManager', () => {
expect(endSpy).not.toHaveBeenCalled();
});

it('should add middleware and call next if no middleware exists for scope, origin, and tabId and request is not "eth_subscribe" or "eth_unsubscribe', () => {
it('call next if no middleware exists for scope, origin, and tabId and request is not "eth_subscribe" or "eth_unsubscribe', () => {
const multichainMiddlewareManager = new MultichainMiddlewareManager();
const middleware =
multichainMiddlewareManager.generateMultichainMiddlewareForOriginAndTabId(
Expand All @@ -129,7 +129,7 @@ describe('MultichainMiddlewareManager', () => {
expect(endSpy).not.toHaveBeenCalled();
});

it('should add middleware and return error if no middleware exists for scope, origin, and tabId and request is "eth_subscribe"', () => {
it('return error if no middleware exists for scope, origin, and tabId and request is "eth_subscribe"', () => {
const multichainMiddlewareManager = new MultichainMiddlewareManager();
const middleware =
multichainMiddlewareManager.generateMultichainMiddlewareForOriginAndTabId(
Expand All @@ -150,7 +150,7 @@ describe('MultichainMiddlewareManager', () => {
expect(endSpy).toHaveBeenCalledWith(rpcErrors.methodNotFound());
});

it('should add middleware and return error if no middleware exists for scope, origin, and tabId and request is "eth_unsubscribe"', () => {
it('return error if no middleware exists for scope, origin, and tabId and request is "eth_unsubscribe"', () => {
const multichainMiddlewareManager = new MultichainMiddlewareManager();
const middleware =
multichainMiddlewareManager.generateMultichainMiddlewareForOriginAndTabId(
Expand Down Expand Up @@ -333,14 +333,14 @@ describe('MultichainMiddlewareManager', () => {
const endSpy = jest.fn();

middleware(
{ jsonrpc: '2.0' as const, id: 0, method: 'eth_subscribe', scope },
{ jsonrpc: '2.0' as const, id: 0, method: 'method', scope },
{ jsonrpc: '2.0', id: 0 },
nextSpy,
endSpy,
);
expect(middlewareSpy).not.toHaveBeenCalled();
expect(nextSpy).not.toHaveBeenCalled();
expect(endSpy).toHaveBeenCalled();
expect(nextSpy).toHaveBeenCalled();
expect(endSpy).not.toHaveBeenCalled();
});

it('should remove middleware by origin and tabId', () => {
Expand All @@ -365,13 +365,13 @@ describe('MultichainMiddlewareManager', () => {
const endSpy = jest.fn();

middleware(
{ jsonrpc: '2.0' as const, id: 0, method: 'eth_subscribe', scope },
{ jsonrpc: '2.0' as const, id: 0, method: 'method', scope },
{ jsonrpc: '2.0', id: 0 },
nextSpy,
endSpy,
);
expect(middlewareSpy).not.toHaveBeenCalled();
expect(nextSpy).not.toHaveBeenCalled();
expect(endSpy).toHaveBeenCalled();
expect(nextSpy).toHaveBeenCalled();
expect(endSpy).not.toHaveBeenCalled();
});
});

0 comments on commit 237eb59

Please sign in to comment.