fix: make sure to use convo getters

instead of backbone get function
pull/2971/head
William Grant 2 years ago
parent d89741cb29
commit 06099966b0

@ -1,5 +1,6 @@
import autoBind from 'auto-bind'; import autoBind from 'auto-bind';
import Backbone from 'backbone'; import Backbone from 'backbone';
import { from_hex } from 'libsodium-wrappers-sumo';
import { import {
debounce, debounce,
includes, includes,
@ -15,7 +16,6 @@ import {
uniq, uniq,
xor, xor,
} from 'lodash'; } from 'lodash';
import { from_hex } from 'libsodium-wrappers-sumo';
import { SignalService } from '../protobuf'; import { SignalService } from '../protobuf';
import { getMessageQueue } from '../session'; import { getMessageQueue } from '../session';
@ -118,8 +118,8 @@ import {
} from '../state/selectors/sogsRoomInfo'; // decide it it makes sense to move this to a redux slice? } from '../state/selectors/sogsRoomInfo'; // decide it it makes sense to move this to a redux slice?
import { import {
DisappearingMessageConversationModeType,
changeToDisappearingMessageType, changeToDisappearingMessageType,
DisappearingMessageConversationModeType,
setExpirationStartTimestamp, setExpirationStartTimestamp,
} from '../util/expiringMessages'; } from '../util/expiringMessages';
import { markAttributesAsReadIfNeeded } from './messageFactory'; import { markAttributesAsReadIfNeeded } from './messageFactory';

@ -563,12 +563,12 @@ describe('Disappearing Messages', () => {
}); });
expect(updateSuccess, 'should be true').to.be.true; expect(updateSuccess, 'should be true').to.be.true;
expect( expect(
conversation.get('expirationMode'), conversation.getExpirationMode(),
'expirationMode should be deleteAfterSend' 'expirationMode should be deleteAfterSend'
).to.equal('deleteAfterSend'); ).to.equal('deleteAfterSend');
expect(conversation.get('expireTimer'), 'expireTimer should be 5 minutes').to.equal(600); expect(conversation.getExpireTimer(), 'expireTimer should be 5 minutes').to.equal(600);
expect( expect(
conversation.get('lastDisappearingMessageChangeTimestamp'), conversation.getLastDisappearingMessageChangeTimestamp(),
'lastDisappearingMessageChangeTimestamp should match the input value' 'lastDisappearingMessageChangeTimestamp should match the input value'
).to.equal(lastDisappearingMessageChangeTimestamp); ).to.equal(lastDisappearingMessageChangeTimestamp);
}); });

@ -271,11 +271,11 @@ describe('libsession_contacts', () => {
expect( expect(
wrapperContact.expirationMode, wrapperContact.expirationMode,
'expirationMode in the wrapper should match the inputted contact' 'expirationMode in the wrapper should match the inputted contact'
).to.equal(contact.get('expirationMode')); ).to.equal(contact.getExpirationMode());
expect( expect(
wrapperContact.expirationTimerSeconds, wrapperContact.expirationTimerSeconds,
'expirationTimerSeconds in the wrapper should match the inputted contact' 'expirationTimerSeconds in the wrapper should match the inputted contact'
).to.equal(contact.get('expireTimer')); ).to.equal(contact.getExpireTimer());
}); });
it('if disappearing messages is on then the wrapper returned values should match the inputted contact', async () => { it('if disappearing messages is on then the wrapper returned values should match the inputted contact', async () => {
const contact = new ConversationModel({ const contact = new ConversationModel({
@ -299,11 +299,11 @@ describe('libsession_contacts', () => {
expect( expect(
wrapperContact.expirationMode, wrapperContact.expirationMode,
'expirationMode in the wrapper should match the inputted contact' 'expirationMode in the wrapper should match the inputted contact'
).to.equal(contact.get('expirationMode')); ).to.equal(contact.getExpirationMode());
expect( expect(
wrapperContact.expirationTimerSeconds, wrapperContact.expirationTimerSeconds,
'expirationTimerSeconds in the wrapper should match the inputted contact expireTimer' 'expirationTimerSeconds in the wrapper should match the inputted contact expireTimer'
).to.equal(contact.get('expireTimer')); ).to.equal(contact.getExpireTimer());
}); });
}); });
}); });

@ -216,7 +216,7 @@ describe('libsession_user_groups', () => {
expect( expect(
wrapperGroup.disappearingTimerSeconds, wrapperGroup.disappearingTimerSeconds,
'disappearingTimerSeconds in the wrapper should match the inputted group' 'disappearingTimerSeconds in the wrapper should match the inputted group'
).to.equal(group.get('expireTimer')); ).to.equal(group.getExpireTimer());
expect( expect(
wrapperGroup.encPubkey.toString(), wrapperGroup.encPubkey.toString(),
'encPubkey in the wrapper should match the inputted group' 'encPubkey in the wrapper should match the inputted group'
@ -257,7 +257,7 @@ describe('libsession_user_groups', () => {
expect( expect(
wrapperGroup.disappearingTimerSeconds, wrapperGroup.disappearingTimerSeconds,
'disappearingTimerSeconds in the wrapper should match the inputted group expireTimer' 'disappearingTimerSeconds in the wrapper should match the inputted group expireTimer'
).to.equal(group.get('expireTimer')); ).to.equal(group.getExpireTimer());
}); });
}); });
}); });

@ -92,7 +92,7 @@ describe('libsession_user_profile', () => {
expect( expect(
wrapperUserProfile.expirySeconds, wrapperUserProfile.expirySeconds,
'expirySeconds in the wrapper should match the inputted user profile' 'expirySeconds in the wrapper should match the inputted user profile'
).to.equal(contact.get('expireTimer')); ).to.equal(contact.getExpireTimer());
}); });
it("returns an error if the inputted user profile isn't our conversation", async () => { it("returns an error if the inputted user profile isn't our conversation", async () => {
const contact = new ConversationModel({ const contact = new ConversationModel({
@ -132,7 +132,7 @@ describe('libsession_user_profile', () => {
expect( expect(
wrapperUserProfile.expirySeconds, wrapperUserProfile.expirySeconds,
'expirySeconds in the wrapper should match the inputted user profile expireTimer' 'expirySeconds in the wrapper should match the inputted user profile expireTimer'
).to.equal(contact.get('expireTimer')); ).to.equal(contact.getExpireTimer());
}); });
}); });
}); });

Loading…
Cancel
Save