Fix lint errors
This commit is contained in:
@@ -60,7 +60,9 @@ export default class AppMenuSettingsNostr extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get hasReadOverrides() {
|
get hasReadOverrides() {
|
||||||
return this.customReadRelays.length > 0 || this.readRelayExclusions.length > 0;
|
return (
|
||||||
|
this.customReadRelays.length > 0 || this.readRelayExclusions.length > 0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get hasWriteOverrides() {
|
get hasWriteOverrides() {
|
||||||
@@ -106,7 +108,10 @@ export default class AppMenuSettingsNostr extends Component {
|
|||||||
...this.customReadRelays,
|
...this.customReadRelays,
|
||||||
url,
|
url,
|
||||||
]);
|
]);
|
||||||
const custom = excludeRequiredRelays(merged, this.nostrData.requiredReadRelays);
|
const custom = excludeRequiredRelays(
|
||||||
|
merged,
|
||||||
|
this.nostrData.requiredReadRelays
|
||||||
|
);
|
||||||
|
|
||||||
const readExclusions = this.readRelayExclusions.filter((relay) => {
|
const readExclusions = this.readRelayExclusions.filter((relay) => {
|
||||||
return normalizeRelayUrl(relay) !== url;
|
return normalizeRelayUrl(relay) !== url;
|
||||||
|
|||||||
@@ -43,7 +43,10 @@ class MockNostrDataService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get activeReadRelays() {
|
get activeReadRelays() {
|
||||||
return mergeRequiredRelays(this.requiredReadRelays, this.configuredReadRelays);
|
return mergeRequiredRelays(
|
||||||
|
this.requiredReadRelays,
|
||||||
|
this.configuredReadRelays
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
get activeWriteRelays() {
|
get activeWriteRelays() {
|
||||||
@@ -131,20 +134,26 @@ module('Integration | Component | app-menu/settings/nostr', function (hooks) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('adding read relay clears existing exclusion for same relay', async function (assert) {
|
test('adding read relay clears existing exclusion for same relay', async function (assert) {
|
||||||
this.settings.update('nostrReadRelayExclusions', ['wss://mailbox.example.com']);
|
this.settings.update('nostrReadRelayExclusions', [
|
||||||
|
'wss://mailbox.example.com',
|
||||||
|
]);
|
||||||
|
|
||||||
const element = await renderAndOpenDetails(this);
|
const element = await renderAndOpenDetails(this);
|
||||||
|
|
||||||
await fillIn('#new-read-relay', 'Mailbox.EXAMPLE.com/');
|
await fillIn('#new-read-relay', 'Mailbox.EXAMPLE.com/');
|
||||||
await click(element.querySelector('#new-read-relay').nextElementSibling);
|
await click(element.querySelector('#new-read-relay').nextElementSibling);
|
||||||
|
|
||||||
assert.deepEqual(this.settings.nostrReadRelays, ['wss://mailbox.example.com']);
|
assert.deepEqual(this.settings.nostrReadRelays, [
|
||||||
|
'wss://mailbox.example.com',
|
||||||
|
]);
|
||||||
assert.strictEqual(this.settings.nostrReadRelayExclusions, null);
|
assert.strictEqual(this.settings.nostrReadRelayExclusions, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('reset read relays clears additions and exclusions', async function (assert) {
|
test('reset read relays clears additions and exclusions', async function (assert) {
|
||||||
this.settings.update('nostrReadRelays', ['wss://custom.example.com']);
|
this.settings.update('nostrReadRelays', ['wss://custom.example.com']);
|
||||||
this.settings.update('nostrReadRelayExclusions', ['wss://mailbox.example.com']);
|
this.settings.update('nostrReadRelayExclusions', [
|
||||||
|
'wss://mailbox.example.com',
|
||||||
|
]);
|
||||||
|
|
||||||
const element = await renderAndOpenDetails(this);
|
const element = await renderAndOpenDetails(this);
|
||||||
await click(element.querySelectorAll('.reset-relays')[0]);
|
await click(element.querySelectorAll('.reset-relays')[0]);
|
||||||
@@ -157,7 +166,9 @@ module('Integration | Component | app-menu/settings/nostr', function (hooks) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('write relays are removable and mailbox delete stores exclusion', async function (assert) {
|
test('write relays are removable and mailbox delete stores exclusion', async function (assert) {
|
||||||
this.settings.update('nostrWriteRelays', ['wss://custom-write.example.com']);
|
this.settings.update('nostrWriteRelays', [
|
||||||
|
'wss://custom-write.example.com',
|
||||||
|
]);
|
||||||
|
|
||||||
const element = await renderAndOpenDetails(this);
|
const element = await renderAndOpenDetails(this);
|
||||||
const rows = writeRows(element);
|
const rows = writeRows(element);
|
||||||
|
|||||||
@@ -197,6 +197,9 @@ module('Unit | Utility | nostr', function () {
|
|||||||
['required.example.com']
|
['required.example.com']
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.deepEqual(relays, ['wss://required.example.com', 'wss://custom.example.com']);
|
assert.deepEqual(relays, [
|
||||||
|
'wss://required.example.com',
|
||||||
|
'wss://custom.example.com',
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user