1 import { DecryptedMessage } from '@proton/docs-shared'
2 import { DecryptedCommit } from './DecryptedCommit'
4 describe('DecryptedCommit', () => {
5 it('should create an instance', () => {
6 const decryptedCommit = new DecryptedCommit('commitId', [
8 content: new Uint8Array([1, 2, 3]),
9 signature: new Uint8Array([4, 5, 6]),
10 authorAddress: 'authorAddress',
15 expect(decryptedCommit).toBeDefined()
18 it('should return byte size', () => {
19 const decryptedCommit = new DecryptedCommit('commitId', [
20 new DecryptedMessage({
21 content: new Uint8Array([1, 2, 3]),
22 signature: new Uint8Array([4, 5, 6]),
23 authorAddress: 'authorAddress',
28 expect(decryptedCommit.byteSize).toBe(22)
31 it('should return number of updates', () => {
32 const decryptedCommit = new DecryptedCommit('commitId', [
33 new DecryptedMessage({
34 content: new Uint8Array([1, 2, 3]),
35 signature: new Uint8Array([4, 5, 6]),
36 authorAddress: 'authorAddress',
41 expect(decryptedCommit.numberOfUpdates()).toBe(1)
44 it('should return needs squash', () => {
45 const decryptedCommit = new DecryptedCommit('commitId', [
46 new DecryptedMessage({
47 content: new Uint8Array([1, 2, 3]),
48 signature: new Uint8Array([4, 5, 6]),
49 authorAddress: 'authorAddress',
54 expect(decryptedCommit.needsSquash()).toBe(false)