2021-02-06 10:59:00 +08:00
|
|
|
import {expect} from 'chai';
|
2020-03-30 20:27:09 +08:00
|
|
|
|
2021-02-08 00:57:12 +08:00
|
|
|
import {clusterApiUrl} from '../src/util/cluster';
|
|
|
|
|
2021-02-06 10:59:00 +08:00
|
|
|
describe('Cluster Util', () => {
|
|
|
|
it('invalid', () => {
|
|
|
|
expect(() => {
|
2021-03-15 13:08:10 +08:00
|
|
|
clusterApiUrl('abc123' as any);
|
2021-02-06 10:59:00 +08:00
|
|
|
}).to.throw();
|
|
|
|
});
|
2020-03-30 20:27:09 +08:00
|
|
|
|
2021-02-06 10: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-06 10:59:00 +08:00
|
|
|
});
|
2020-03-30 20:27:09 +08:00
|
|
|
});
|