Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit ab54d5b

Browse files
Merge pull request #976 from lightninglabs/sat-default
Preselect SAT as default for Bitcoin values
2 parents f50b7dc + 1df65e1 commit ab54d5b

File tree

11 files changed

+20
-11
lines changed

11 files changed

+20
-11
lines changed

src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ module.exports.FIATS = {
3939
eur: { display: '€', displayLong: 'Euro' },
4040
gbp: { display: '£', displayLong: 'British Pound' },
4141
};
42-
module.exports.DEFAULT_UNIT = 'btc';
42+
module.exports.DEFAULT_UNIT = 'sat';
4343
module.exports.DEFAULT_FIAT = 'usd';

test/integration/action/action-integration.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ describe('Action Integration Tests', function() {
120120
sandbox.stub(logger);
121121
store1 = new Store();
122122
store2 = new Store();
123+
store1.settings.unit = 'btc';
124+
store2.settings.unit = 'btc';
123125
store1.settings.displayFiat = false;
124126
store2.settings.displayFiat = false;
125127
store1.init();

test/unit/action/app-storage.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ describe('Action App Storage Unit Tests', () => {
2828
it('should use default if nothing is saved yet', async () => {
2929
AsyncStorageStub.getItem.resolves(undefined);
3030
await db.restore(AsyncStorageStub);
31-
expect(store.settings.unit, 'to equal', 'btc');
31+
expect(store.settings.unit, 'to equal', 'sat');
3232
expect(logger.error, 'was not called');
3333
expect(store.loaded, 'to be', true);
3434
});
3535

3636
it('should set supported setting', async () => {
3737
AsyncStorageStub.getItem
3838
.withArgs('settings')
39-
.resolves(JSON.stringify({ unit: 'sat' }));
39+
.resolves(JSON.stringify({ unit: 'btc' }));
4040
await db.restore(AsyncStorageStub);
41-
expect(store.settings.unit, 'to equal', 'sat');
41+
expect(store.settings.unit, 'to equal', 'btc');
4242
expect(store.loaded, 'to be', true);
4343
});
4444

test/unit/action/channel.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ describe('Action Channels Unit Tests', () => {
2121
sandbox = sinon.createSandbox({});
2222
sandbox.stub(logger);
2323
store = new Store();
24+
store.settings.unit = 'btc';
2425
store.settings.displayFiat = false;
2526
require('../../../src/config').RETRY_DELAY = 1;
2627
grpc = sinon.createStubInstance(GrpcAction);

test/unit/action/invoice.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ describe('Action Invoice Unit Tests', () => {
1414

1515
beforeEach(() => {
1616
store = new Store();
17+
store.settings.unit = 'btc';
1718
store.settings.displayFiat = false;
1819
require('../../../src/config').RETRY_DELAY = 1;
1920
nav = sinon.createStubInstance(NavAction);

test/unit/action/payment.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ describe('Action Payments Unit Tests', () => {
2121
sandbox = sinon.createSandbox({});
2222
sandbox.stub(logger);
2323
store = new Store();
24+
store.settings.unit = 'btc';
2425
store.settings.displayFiat = false;
2526
require('../../../src/config').RETRY_DELAY = 1;
2627
require('../../../src/config').PAYMENT_TIMEOUT = 1;

test/unit/computed/channel.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ describe('Computed Channels Unit Tests', () => {
66

77
beforeEach(() => {
88
store = new Store();
9+
store.settings.unit = 'btc';
910
store.settings.displayFiat = false;
1011
store.channels.push({
1112
remotePubkey: 'some-pub-key',

test/unit/computed/invoice.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ describe('Computed Invoice Unit Tests', () => {
66

77
beforeEach(() => {
88
store = new Store();
9+
store.settings.unit = 'btc';
910
store.settings.displayFiat = false;
1011
});
1112

test/unit/computed/payment.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ describe('Computed Payment Unit Tests', () => {
66

77
beforeEach(() => {
88
store = new Store();
9+
store.settings.unit = 'btc';
910
store.settings.displayFiat = false;
1011
});
1112

test/unit/computed/setting.spec.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ describe('Computed Settings Unit Tests', () => {
1111
describe('ComputedSetting()', () => {
1212
it('should work with initial store', () => {
1313
ComputedSetting(store);
14-
expect(store.selectedUnitLabel, 'to equal', 'Bitcoin');
14+
expect(
15+
store.selectedUnitLabel,
16+
'to match',
17+
/Satoshi {3}\(0[,.]00000001 BTC\)/
18+
);
1519
expect(store.selectedFiatLabel, 'to equal', 'US Dollar');
1620
expect(store.satUnitLabel, 'to be ok');
1721
expect(store.bitUnitLabel, 'to be ok');
@@ -22,13 +26,9 @@ describe('Computed Settings Unit Tests', () => {
2226
});
2327

2428
it('should display satoshis denominated in BTC', () => {
25-
store.settings.unit = 'sat';
29+
store.settings.unit = 'btc';
2630
ComputedSetting(store);
27-
expect(
28-
store.selectedUnitLabel,
29-
'to match',
30-
/Satoshi {3}\(0[,.]00000001 BTC\)/
31-
);
31+
expect(store.selectedUnitLabel, 'to equal', 'Bitcoin');
3232
});
3333
});
3434
});

0 commit comments

Comments
 (0)