solana/web3.js/test/cluster.test.ts

23 lines
589 B
TypeScript
Raw Normal View History

2021-02-05 18:59:00 -08:00
import {expect} from 'chai';
2020-03-30 05:27:09 -07:00
2021-02-07 08:57:12 -08:00
import {clusterApiUrl} from '../src/util/cluster';
2021-02-05 18:59:00 -08:00
describe('Cluster Util', () => {
it('invalid', () => {
expect(() => {
2021-03-14 22:08:10 -07:00
clusterApiUrl('abc123' as any);
2021-02-05 18:59:00 -08:00
}).to.throw();
});
2020-03-30 05:27:09 -07:00
2021-02-05 18:59:00 -08:00
it('devnet', () => {
2021-05-12 08:33:33 -07:00
expect(clusterApiUrl()).to.eq('https://api.devnet.solana.com');
expect(clusterApiUrl('devnet')).to.eq('https://api.devnet.solana.com');
expect(clusterApiUrl('devnet', true)).to.eq(
'https://api.devnet.solana.com',
);
expect(clusterApiUrl('devnet', false)).to.eq(
'http://api.devnet.solana.com',
);
2021-02-05 18:59:00 -08:00
});
2020-03-30 05:27:09 -07:00
});