Skip to content

Commit c80b44d

Browse files
luxbetgerboui
andauthored
refactor(nano name service): introduce NameService RPC parameter
Co-authored-by: tgerboui <thomasgerbouin@gmail.com>
1 parent 7dd9d11 commit c80b44d

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

lib/services/name/name-service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import { Rpc } from '../rpc/rpc';
1212
import { NameInfo } from './name-schemas';
1313

1414
export class NameService extends RpcConsummer {
15-
constructor() {
16-
super(new Rpc({ url: 'http://rpc.nano.to' }));
15+
constructor(rpc = new Rpc({ url: 'https://rpc.nano.to' })) {
16+
super(rpc);
1717
}
1818
public async resolveUsername(username: NanoUsername): Promise<NanoAddress> {
1919
const res = await this.rpc.call('account_key', { account: username });

test/unit/services/name-service.test.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ describe('NameService', () => {
1212

1313
beforeEach(() => {
1414
rpcMock = new Rpc({ url: 'http://example.com' }) as jest.Mocked<Rpc>;
15-
nameService = new NameService();
16-
nameService['rpc'] = rpcMock;
15+
nameService = new NameService(rpcMock);
1716
});
1817

1918
it('should initialize properties correctly', () => {

0 commit comments

Comments
 (0)