fix test failures

This commit is contained in:
Hazelnoot 2024-10-12 15:30:38 -04:00
parent 9b1bae653d
commit d3792ab201

View file

@ -4,61 +4,61 @@ import { MiNote } from '@/models/Note.js';
describe(SkLatestNote, () => { describe(SkLatestNote, () => {
describe('keyFor', () => { describe('keyFor', () => {
it('should include userId', () => { it('should include userId', () => {
const note = new MiNote({ userId: 'abc123' }); const note = new MiNote({ userId: 'abc123', fileIds: [] });
const key = SkLatestNote.keyFor(note); const key = SkLatestNote.keyFor(note);
expect(key.userId).toBe(note.userId); expect(key.userId).toBe(note.userId);
}); });
it('should include isPublic when is public', () => { it('should include isPublic when is public', () => {
const note = new MiNote({ visibility: 'public' }); const note = new MiNote({ visibility: 'public', fileIds: [] });
const key = SkLatestNote.keyFor(note); const key = SkLatestNote.keyFor(note);
expect(key.isPublic).toBeTruthy(); expect(key.isPublic).toBeTruthy();
}); });
it('should include isPublic when is home-only', () => { it('should include isPublic when is home-only', () => {
const note = new MiNote({ visibility: 'home' }); const note = new MiNote({ visibility: 'home', fileIds: [] });
const key = SkLatestNote.keyFor(note); const key = SkLatestNote.keyFor(note);
expect(key.isPublic).toBeFalsy(); expect(key.isPublic).toBeFalsy();
}); });
it('should include isPublic when is followers-only', () => { it('should include isPublic when is followers-only', () => {
const note = new MiNote({ visibility: 'followers' }); const note = new MiNote({ visibility: 'followers', fileIds: [] });
const key = SkLatestNote.keyFor(note); const key = SkLatestNote.keyFor(note);
expect(key.isPublic).toBeFalsy(); expect(key.isPublic).toBeFalsy();
}); });
it('should include isPublic when is specified', () => { it('should include isPublic when is specified', () => {
const note = new MiNote({ visibility: 'specified' }); const note = new MiNote({ visibility: 'specified', fileIds: [] });
const key = SkLatestNote.keyFor(note); const key = SkLatestNote.keyFor(note);
expect(key.isPublic).toBeFalsy(); expect(key.isPublic).toBeFalsy();
}); });
it('should include isReply when is reply', () => { it('should include isReply when is reply', () => {
const note = new MiNote({ replyId: 'abc123' }); const note = new MiNote({ replyId: 'abc123', fileIds: [] });
const key = SkLatestNote.keyFor(note); const key = SkLatestNote.keyFor(note);
expect(key.isReply).toBeTruthy(); expect(key.isReply).toBeTruthy();
}); });
it('should include isReply when is not reply', () => { it('should include isReply when is not reply', () => {
const note = new MiNote({ replyId: null }); const note = new MiNote({ replyId: null, fileIds: [] });
const key = SkLatestNote.keyFor(note); const key = SkLatestNote.keyFor(note);
expect(key.isReply).toBeFalsy(); expect(key.isReply).toBeFalsy();
}); });
it('should include isQuote when is quote', () => { it('should include isQuote when is quote', () => {
const note = new MiNote({ renoteId: 'abc123', text: 'text' }); const note = new MiNote({ renoteId: 'abc123', text: 'text', fileIds: [] });
const key = SkLatestNote.keyFor(note); const key = SkLatestNote.keyFor(note);
expect(key.isQuote).toBeTruthy(); expect(key.isQuote).toBeTruthy();
}); });
it('should include isQuote when is reblog', () => { it('should include isQuote when is reblog', () => {
const note = new MiNote({ renoteId: 'abc123' }); const note = new MiNote({ renoteId: 'abc123', fileIds: [] });
const key = SkLatestNote.keyFor(note); const key = SkLatestNote.keyFor(note);
expect(key.isQuote).toBeFalsy(); expect(key.isQuote).toBeFalsy();
}); });
it('should include isQuote when is neither quote nor reblog', () => { it('should include isQuote when is neither quote nor reblog', () => {
const note = new MiNote({ renoteId: null }); const note = new MiNote({ renoteId: null, fileIds: [] });
const key = SkLatestNote.keyFor(note); const key = SkLatestNote.keyFor(note);
expect(key.isQuote).toBeFalsy(); expect(key.isQuote).toBeFalsy();
}); });