Skip to content

Commit eb0780d

Browse files
committed
chore: fix lint and tests
1 parent 09310ab commit eb0780d

File tree

5 files changed

+9
-22
lines changed

5 files changed

+9
-22
lines changed

.eslintignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@ about_preload.js
2222
commitlint.config.js
2323
password_preload.js
2424
sass.config.js
25-
*.worker.config.js
25+
*.worker.config.js
26+
27+
# Not too sure why we can't have eslint on those files atm
28+
ts/webworker/workers/node/util/util.worker.ts
29+
ts/webworker/workers/node/libsession/libsession.worker.ts
30+
ts/webworker/workers/node/image_processor/image_processor.worker.ts

ts/session/apis/file_server_api/FileServerApi.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export const uploadFileToFsWithOnionV4 = async (
7474
}
7575
const fileUrl = `${fileServerURL}${POST_GET_FILE_ENDPOINT}/${fileId}`;
7676
const expiresMs = Math.floor(expires * 1000);
77-
console.warn('fileUrl', fileUrl);
7877
return {
7978
fileUrl,
8079
expiresMs,

ts/session/utils/Attachments.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@ export function attachmentIdAsStrFromUrl(url: string) {
158158
}
159159

160160
export function attachmentIdAsLongFromUrl(url: string) {
161-
const urlObj = new URL(url);
162-
163-
const lastSegment = urlObj.pathname.split('/').pop();
161+
const lastSegment = url?.split('/')?.pop();
164162
if (!lastSegment) {
165163
throw new Error('attachmentIdAsLongFromUrl last is not valid');
166164
}

ts/test/session/unit/messages/ChatMessage_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ describe('VisibleMessage', () => {
141141

142142
it('can create message with an AttachmentPointer', () => {
143143
const attachment: AttachmentPointerWithUrl = {
144-
url: 'url',
144+
url: 'http://thisisaareal/url/1234',
145145
contentType: 'contentType',
146146
};
147147
const attachments = new Array<AttachmentPointerWithUrl>();
@@ -159,7 +159,7 @@ describe('VisibleMessage', () => {
159159
const decodedID = toNumber(firstAttachment?.id);
160160
expect(decodedID).to.be.equal(1234);
161161
expect(firstAttachment?.contentType).to.be.deep.equal('contentType');
162-
expect(firstAttachment?.url).to.be.deep.equal('url');
162+
expect(firstAttachment?.url).to.be.deep.equal('http://thisisaareal/url/1234');
163163
});
164164

165165
it('correct ttl', () => {

ts/test/types/initializeAttachmentMetadata_test.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ describe('initializeAttachmentMetadata', () => {
7272
expect(hasFileAttachmentInMessage(msgModel)).to.be.eq(false);
7373
});
7474

75-
it('first attachment is audio should return false', () => {
76-
const msgModel = generateFakeIncomingPrivateMessage();
77-
msgModel.set({ attachments: [{ contentType: 'audio/mp3' }] });
78-
expect(hasFileAttachmentInMessage(msgModel)).to.be.eq(false);
79-
});
80-
8175
it('first attachment is flagged as voice message should return false', () => {
8276
const msgModel = generateFakeIncomingPrivateMessage();
8377
msgModel.set({
@@ -240,15 +234,6 @@ describe('initializeAttachmentMetadata', () => {
240234
expect(mt.hasVisualMediaAttachments).to.be.eq(1);
241235
});
242236

243-
it('has one audio attachment only', () => {
244-
const msgModel = generateFakeIncomingPrivateMessage();
245-
msgModel.setKey('attachments', [{ contentType: 'audio/mp3' }]);
246-
const mt = getAttachmentMetadata(msgModel);
247-
expect(mt.hasAttachments).to.be.eq(1);
248-
expect(mt.hasFileAttachments).to.be.eq(0);
249-
expect(mt.hasVisualMediaAttachments).to.be.eq(0);
250-
});
251-
252237
it('has one file attachment only', () => {
253238
const msgModel = generateFakeIncomingPrivateMessage();
254239
msgModel.setKey('attachments', [{ contentType: 'whatever' }]);

0 commit comments

Comments
 (0)