|
@@ -4,6 +4,7 @@ const _ = require('lodash')
|
|
|
const { expect } = require('chai')
|
|
const { expect } = require('chai')
|
|
|
|
|
|
|
|
const ot = require('..')
|
|
const ot = require('..')
|
|
|
|
|
+const StringFileData = require('../lib/file_data/string_file_data')
|
|
|
const File = ot.File
|
|
const File = ot.File
|
|
|
const AddFileOperation = ot.AddFileOperation
|
|
const AddFileOperation = ot.AddFileOperation
|
|
|
const MoveFileOperation = ot.MoveFileOperation
|
|
const MoveFileOperation = ot.MoveFileOperation
|
|
@@ -11,6 +12,9 @@ const EditFileOperation = ot.EditFileOperation
|
|
|
const NoOperation = ot.NoOperation
|
|
const NoOperation = ot.NoOperation
|
|
|
const Operation = ot.Operation
|
|
const Operation = ot.Operation
|
|
|
const TextOperation = ot.TextOperation
|
|
const TextOperation = ot.TextOperation
|
|
|
|
|
+const AddCommentOperation = ot.AddCommentOperation
|
|
|
|
|
+const DeleteCommentOperation = ot.DeleteCommentOperation
|
|
|
|
|
+const SetCommentStateOperation = ot.SetCommentStateOperation
|
|
|
const Snapshot = ot.Snapshot
|
|
const Snapshot = ot.Snapshot
|
|
|
|
|
|
|
|
describe('Operation', function () {
|
|
describe('Operation', function () {
|
|
@@ -71,7 +75,12 @@ describe('Operation', function () {
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
expectNoTransform() {
|
|
expectNoTransform() {
|
|
|
- expect(this.operations).to.eql(this.primeOperations)
|
|
|
|
|
|
|
+ expect(this.operations).to.deep.eql(this.primeOperations)
|
|
|
|
|
+ return this
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ expectTransform() {
|
|
|
|
|
+ expect(this.operations).to.not.deep.eql(this.primeOperations)
|
|
|
return this
|
|
return this
|
|
|
},
|
|
},
|
|
|
|
|
|
|
@@ -84,11 +93,12 @@ describe('Operation', function () {
|
|
|
expect(this.snapshot.countFiles()).to.equal(_.size(files))
|
|
expect(this.snapshot.countFiles()).to.equal(_.size(files))
|
|
|
_.forOwn(files, (expectedFile, pathname) => {
|
|
_.forOwn(files, (expectedFile, pathname) => {
|
|
|
if (_.isString(expectedFile)) {
|
|
if (_.isString(expectedFile)) {
|
|
|
- expectedFile = { content: expectedFile, metadata: {} }
|
|
|
|
|
|
|
+ expectedFile = { content: expectedFile, metadata: {}, comments: [] }
|
|
|
}
|
|
}
|
|
|
const file = this.snapshot.getFile(pathname)
|
|
const file = this.snapshot.getFile(pathname)
|
|
|
expect(file.getContent()).to.equal(expectedFile.content)
|
|
expect(file.getContent()).to.equal(expectedFile.content)
|
|
|
expect(file.getMetadata()).to.eql(expectedFile.metadata)
|
|
expect(file.getMetadata()).to.eql(expectedFile.metadata)
|
|
|
|
|
+ expect(file.getComments()).to.deep.equal(expectedFile.comments)
|
|
|
})
|
|
})
|
|
|
return this
|
|
return this
|
|
|
},
|
|
},
|
|
@@ -240,7 +250,10 @@ describe('Operation', function () {
|
|
|
makeOneFileSnapshot()
|
|
makeOneFileSnapshot()
|
|
|
)
|
|
)
|
|
|
.expectNoTransform()
|
|
.expectNoTransform()
|
|
|
- .expectFiles({ foo: { content: '', metadata: testMetadata }, bar: 'a' })
|
|
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: { content: '', metadata: testMetadata, comments: [] },
|
|
|
|
|
+ bar: 'a',
|
|
|
|
|
+ })
|
|
|
.expectSymmetry()
|
|
.expectSymmetry()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -251,7 +264,9 @@ describe('Operation', function () {
|
|
|
Operation.setFileMetadata('foo', testMetadata),
|
|
Operation.setFileMetadata('foo', testMetadata),
|
|
|
makeEmptySnapshot()
|
|
makeEmptySnapshot()
|
|
|
)
|
|
)
|
|
|
- .expectFiles({ foo: { content: 'x', metadata: testMetadata } })
|
|
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: { content: 'x', metadata: testMetadata, comments: [] },
|
|
|
|
|
+ })
|
|
|
.expectSymmetry()
|
|
.expectSymmetry()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -574,7 +589,10 @@ describe('Operation', function () {
|
|
|
makeTwoFileSnapshot()
|
|
makeTwoFileSnapshot()
|
|
|
)
|
|
)
|
|
|
.expectNoTransform()
|
|
.expectNoTransform()
|
|
|
- .expectFiles({ bar: { content: 'a', metadata: testMetadata }, baz: '' })
|
|
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ bar: { content: 'a', metadata: testMetadata, comments: [] },
|
|
|
|
|
+ baz: '',
|
|
|
|
|
+ })
|
|
|
.expectSymmetry()
|
|
.expectSymmetry()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -585,7 +603,9 @@ describe('Operation', function () {
|
|
|
Operation.setFileMetadata('foo', testMetadata),
|
|
Operation.setFileMetadata('foo', testMetadata),
|
|
|
makeOneFileSnapshot()
|
|
makeOneFileSnapshot()
|
|
|
)
|
|
)
|
|
|
- .expectFiles({ bar: { content: '', metadata: testMetadata } })
|
|
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ bar: { content: '', metadata: testMetadata, comments: [] },
|
|
|
|
|
+ })
|
|
|
.expectSymmetry()
|
|
.expectSymmetry()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -597,7 +617,7 @@ describe('Operation', function () {
|
|
|
makeTwoFileSnapshot()
|
|
makeTwoFileSnapshot()
|
|
|
)
|
|
)
|
|
|
// move wins
|
|
// move wins
|
|
|
- .expectFiles({ bar: { content: '', metadata: {} } })
|
|
|
|
|
|
|
+ .expectFiles({ bar: { content: '', metadata: {}, comments: [] } })
|
|
|
.expectSymmetry()
|
|
.expectSymmetry()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -608,7 +628,9 @@ describe('Operation', function () {
|
|
|
Operation.setFileMetadata('foo', testMetadata),
|
|
Operation.setFileMetadata('foo', testMetadata),
|
|
|
makeOneFileSnapshot()
|
|
makeOneFileSnapshot()
|
|
|
)
|
|
)
|
|
|
- .expectFiles({ foo: { content: '', metadata: testMetadata } })
|
|
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: { content: '', metadata: testMetadata, comments: [] },
|
|
|
|
|
+ })
|
|
|
.expectSymmetry()
|
|
.expectSymmetry()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -674,8 +696,8 @@ describe('Operation', function () {
|
|
|
)
|
|
)
|
|
|
.expectNoTransform()
|
|
.expectNoTransform()
|
|
|
.expectFiles({
|
|
.expectFiles({
|
|
|
- foo: { content: 'x', metadata: {} },
|
|
|
|
|
- bar: { content: 'a', metadata: testMetadata },
|
|
|
|
|
|
|
+ foo: { content: 'x', metadata: {}, comments: [] },
|
|
|
|
|
+ bar: { content: 'a', metadata: testMetadata, comments: [] },
|
|
|
})
|
|
})
|
|
|
.expectSymmetry()
|
|
.expectSymmetry()
|
|
|
})
|
|
})
|
|
@@ -688,7 +710,9 @@ describe('Operation', function () {
|
|
|
makeOneFileSnapshot()
|
|
makeOneFileSnapshot()
|
|
|
)
|
|
)
|
|
|
.expectNoTransform()
|
|
.expectNoTransform()
|
|
|
- .expectFiles({ foo: { content: 'x', metadata: testMetadata } })
|
|
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: { content: 'x', metadata: testMetadata, comments: [] },
|
|
|
|
|
+ })
|
|
|
.expectSymmetry()
|
|
.expectSymmetry()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -700,8 +724,8 @@ describe('Operation', function () {
|
|
|
)
|
|
)
|
|
|
.expectNoTransform()
|
|
.expectNoTransform()
|
|
|
.expectFiles({
|
|
.expectFiles({
|
|
|
- foo: { content: '', metadata: { baz: 1 } },
|
|
|
|
|
- bar: { content: 'a', metadata: { baz: 2 } },
|
|
|
|
|
|
|
+ foo: { content: '', metadata: { baz: 1 }, comments: [] },
|
|
|
|
|
+ bar: { content: 'a', metadata: { baz: 2 }, comments: [] },
|
|
|
})
|
|
})
|
|
|
.expectSymmetry()
|
|
.expectSymmetry()
|
|
|
})
|
|
})
|
|
@@ -713,10 +737,10 @@ describe('Operation', function () {
|
|
|
makeOneFileSnapshot()
|
|
makeOneFileSnapshot()
|
|
|
)
|
|
)
|
|
|
// second op wins
|
|
// second op wins
|
|
|
- .expectFiles({ foo: { content: '', metadata: { baz: 2 } } })
|
|
|
|
|
|
|
+ .expectFiles({ foo: { content: '', metadata: { baz: 2 }, comments: [] } })
|
|
|
.swap()
|
|
.swap()
|
|
|
// first op wins
|
|
// first op wins
|
|
|
- .expectFiles({ foo: { content: '', metadata: { baz: 1 } } })
|
|
|
|
|
|
|
+ .expectFiles({ foo: { content: '', metadata: { baz: 1 }, comments: [] } })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('transforms SetFileMetadata-RemoveFile with no conflict', function () {
|
|
it('transforms SetFileMetadata-RemoveFile with no conflict', function () {
|
|
@@ -727,7 +751,9 @@ describe('Operation', function () {
|
|
|
makeTwoFileSnapshot()
|
|
makeTwoFileSnapshot()
|
|
|
)
|
|
)
|
|
|
.expectNoTransform()
|
|
.expectNoTransform()
|
|
|
- .expectFiles({ foo: { content: '', metadata: testMetadata } })
|
|
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: { content: '', metadata: testMetadata, comments: [] },
|
|
|
|
|
+ })
|
|
|
.expectSymmetry()
|
|
.expectSymmetry()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -747,4 +773,307 @@ describe('Operation', function () {
|
|
|
foo: 'test',
|
|
foo: 'test',
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ describe('EditFile sub operations', function () {
|
|
|
|
|
+ it('transforms AddCommentOperation-AddCommentOperation', function () {
|
|
|
|
|
+ runConcurrently(
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ AddCommentOperation.fromJSON({
|
|
|
|
|
+ commentId: '1',
|
|
|
|
|
+ ranges: [
|
|
|
|
|
+ {
|
|
|
|
|
+ pos: 10,
|
|
|
|
|
+ length: 2,
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ AddCommentOperation.fromJSON({
|
|
|
|
|
+ commentId: '1',
|
|
|
|
|
+ ranges: [
|
|
|
|
|
+ {
|
|
|
|
|
+ pos: 0,
|
|
|
|
|
+ length: 1,
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ makeOneFileSnapshot()
|
|
|
|
|
+ )
|
|
|
|
|
+ .expectTransform()
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: {
|
|
|
|
|
+ content: '',
|
|
|
|
|
+ metadata: {},
|
|
|
|
|
+ comments: [
|
|
|
|
|
+ {
|
|
|
|
|
+ id: '1',
|
|
|
|
|
+ ranges: [
|
|
|
|
|
+ {
|
|
|
|
|
+ pos: 0,
|
|
|
|
|
+ length: 1,
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ resolved: false,
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('transforms TextOperation-AddCommentOperation', function () {
|
|
|
|
|
+ runConcurrently(
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ TextOperation.fromJSON({ textOperation: ['xyz'] })
|
|
|
|
|
+ ),
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ AddCommentOperation.fromJSON({
|
|
|
|
|
+ commentId: '1',
|
|
|
|
|
+ ranges: [
|
|
|
|
|
+ {
|
|
|
|
|
+ pos: 0,
|
|
|
|
|
+ length: 1,
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ makeOneFileSnapshot()
|
|
|
|
|
+ )
|
|
|
|
|
+ .expectTransform()
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: {
|
|
|
|
|
+ content: 'xyz',
|
|
|
|
|
+ metadata: {},
|
|
|
|
|
+ comments: [
|
|
|
|
|
+ { id: '1', ranges: [{ pos: 3, length: 1 }], resolved: false },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ .expectSymmetry()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('transforms TextOperation-AddCommentOperation (insert with commentId)', function () {
|
|
|
|
|
+ runConcurrently(
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ TextOperation.fromJSON({
|
|
|
|
|
+ textOperation: [{ i: 'xyz', commentIds: ['1'] }],
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ AddCommentOperation.fromJSON({
|
|
|
|
|
+ commentId: '1',
|
|
|
|
|
+ ranges: [
|
|
|
|
|
+ {
|
|
|
|
|
+ pos: 0,
|
|
|
|
|
+ length: 1,
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ makeOneFileSnapshot()
|
|
|
|
|
+ )
|
|
|
|
|
+ .expectTransform()
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: {
|
|
|
|
|
+ content: 'xyz',
|
|
|
|
|
+ metadata: {},
|
|
|
|
|
+ comments: [
|
|
|
|
|
+ { id: '1', ranges: [{ pos: 0, length: 4 }], resolved: false },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ .expectSymmetry()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('transforms AddCommentOperation-SetCommentStateOperation', function () {
|
|
|
|
|
+ runConcurrently(
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ AddCommentOperation.fromJSON({
|
|
|
|
|
+ commentId: '1',
|
|
|
|
|
+ ranges: [{ pos: 1, length: 2 }],
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ SetCommentStateOperation.fromJSON({
|
|
|
|
|
+ commentId: '1',
|
|
|
|
|
+ resolved: true,
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ makeOneFileSnapshot()
|
|
|
|
|
+ )
|
|
|
|
|
+ .expectTransform()
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: {
|
|
|
|
|
+ content: '',
|
|
|
|
|
+ metadata: {},
|
|
|
|
|
+ comments: [
|
|
|
|
|
+ { id: '1', ranges: [{ pos: 1, length: 2 }], resolved: true },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ .expectSymmetry()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('transforms AddCommentOperation-DeleteCommentOperation ', function () {
|
|
|
|
|
+ runConcurrently(
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ AddCommentOperation.fromJSON({
|
|
|
|
|
+ commentId: '1',
|
|
|
|
|
+ ranges: [{ pos: 1, length: 2 }],
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ DeleteCommentOperation.fromJSON({ deleteComment: '1' })
|
|
|
|
|
+ ),
|
|
|
|
|
+ makeOneFileSnapshot()
|
|
|
|
|
+ )
|
|
|
|
|
+ .expectTransform()
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: {
|
|
|
|
|
+ content: '',
|
|
|
|
|
+ metadata: {},
|
|
|
|
|
+ comments: [],
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ .expectSymmetry()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('transforms DeleteCommentOperation-SetCommentStateOperation ', function () {
|
|
|
|
|
+ runConcurrently(
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ DeleteCommentOperation.fromJSON({ deleteComment: '1' })
|
|
|
|
|
+ ),
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ SetCommentStateOperation.fromJSON({
|
|
|
|
|
+ commentId: '1',
|
|
|
|
|
+ resolved: true,
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ makeOneFileSnapshot()
|
|
|
|
|
+ )
|
|
|
|
|
+ .expectTransform()
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: {
|
|
|
|
|
+ content: '',
|
|
|
|
|
+ metadata: {},
|
|
|
|
|
+ comments: [],
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ .expectSymmetry()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('transforms DeleteCommentOperation-DeleteCommentOperation ', function () {
|
|
|
|
|
+ runConcurrently(
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ DeleteCommentOperation.fromJSON({ deleteComment: '1' })
|
|
|
|
|
+ ),
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ DeleteCommentOperation.fromJSON({ deleteComment: '1' })
|
|
|
|
|
+ ),
|
|
|
|
|
+ makeOneFileSnapshot()
|
|
|
|
|
+ )
|
|
|
|
|
+ .expectTransform()
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: {
|
|
|
|
|
+ content: '',
|
|
|
|
|
+ metadata: {},
|
|
|
|
|
+ comments: [],
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ .expectSymmetry()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('transforms SetCommentStateOperation-SetCommentStateOperation to resolved comment', function () {
|
|
|
|
|
+ const snapshot = makeEmptySnapshot()
|
|
|
|
|
+ const file = new File(
|
|
|
|
|
+ new StringFileData('xyz', [
|
|
|
|
|
+ { id: '1', ranges: [{ pos: 0, length: 3 }] },
|
|
|
|
|
+ ])
|
|
|
|
|
+ )
|
|
|
|
|
+ snapshot.addFile('foo', file)
|
|
|
|
|
+
|
|
|
|
|
+ runConcurrently(
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ SetCommentStateOperation.fromJSON({
|
|
|
|
|
+ commentId: '1',
|
|
|
|
|
+ resolved: true,
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ SetCommentStateOperation.fromJSON({
|
|
|
|
|
+ commentId: '1',
|
|
|
|
|
+ resolved: true,
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ snapshot
|
|
|
|
|
+ )
|
|
|
|
|
+ .expectTransform()
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: {
|
|
|
|
|
+ content: 'xyz',
|
|
|
|
|
+ metadata: {},
|
|
|
|
|
+ comments: [
|
|
|
|
|
+ { id: '1', ranges: [{ pos: 0, length: 3 }], resolved: true },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ .expectSymmetry()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('transforms SetCommentStateOperation-SetCommentStateOperation to unresolved comment', function () {
|
|
|
|
|
+ const snapshot = makeEmptySnapshot()
|
|
|
|
|
+ const file = new File(
|
|
|
|
|
+ new StringFileData('xyz', [
|
|
|
|
|
+ { id: '1', ranges: [{ pos: 0, length: 3 }] },
|
|
|
|
|
+ ])
|
|
|
|
|
+ )
|
|
|
|
|
+ snapshot.addFile('foo', file)
|
|
|
|
|
+
|
|
|
|
|
+ runConcurrently(
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ SetCommentStateOperation.fromJSON({
|
|
|
|
|
+ commentId: '1',
|
|
|
|
|
+ resolved: true,
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ Operation.editFile(
|
|
|
|
|
+ 'foo',
|
|
|
|
|
+ SetCommentStateOperation.fromJSON({
|
|
|
|
|
+ commentId: '1',
|
|
|
|
|
+ resolved: false,
|
|
|
|
|
+ })
|
|
|
|
|
+ ),
|
|
|
|
|
+ snapshot
|
|
|
|
|
+ )
|
|
|
|
|
+ .expectTransform()
|
|
|
|
|
+ .expectFiles({
|
|
|
|
|
+ foo: {
|
|
|
|
|
+ content: 'xyz',
|
|
|
|
|
+ metadata: {},
|
|
|
|
|
+ comments: [
|
|
|
|
|
+ { id: '1', ranges: [{ pos: 0, length: 3 }], resolved: false },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
|
|
+ })
|
|
|
|
|
+ .expectSymmetry()
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|