Skip to content

Commit 758c4fb

Browse files
committed
test/integration/move: Fix and remove FIXMEs
1 parent 7e93794 commit 758c4fb

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

test/integration/move.js

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,8 @@ describe('Move', () => {
177177

178178
it('local', async () => {
179179
const oldFolder = await pouch.byRemoteIdMaybeAsync(dir._id)
180-
// FIXME: Why is this a file? And why does it break with a directory?
181180
const doc = builders
182-
.metafile()
181+
.metadir()
183182
.path('parent/dst/dir')
184183
.build()
185184

@@ -228,17 +227,23 @@ describe('Move', () => {
228227
await cozy.files.updateAttributesById(dir._id, { dir_id: dst._id })
229228
await helpers.remote.pullChanges()
230229

231-
/* FIXME: Nondeterministic
232-
should(helpers.putDocs('path', '_deleted', 'trashed')).deepEqual([
233-
{path: 'parent/src/dir/subdir/file', _deleted: true},
234-
{path: 'parent/src/dir/subdir', _deleted: true},
235-
{path: 'parent/src/dir/empty-subdir', _deleted: true},
236-
{path: 'parent/src/dir', _deleted: true},
237-
{path: 'parent/dst/dir'},
238-
{path: 'parent/dst/dir/subdir'},
239-
{path: 'parent/dst/dir/empty-subdir'}
230+
should(
231+
helpers.putDocs('path', '_deleted', 'trashed', 'childMove')
232+
).deepEqual([
233+
{ path: 'parent/src/dir', _deleted: true },
234+
{ path: 'parent/dst/dir' },
235+
{
236+
path: 'parent/src/dir/empty-subdir',
237+
_deleted: true,
238+
childMove: true
239+
},
240+
{ path: 'parent/dst/dir/empty-subdir' },
241+
{ path: 'parent/src/dir/subdir', _deleted: true, childMove: true },
242+
{ path: 'parent/dst/dir/subdir' },
243+
{ path: 'parent/src/dir/subdir/file', _deleted: true, childMove: true },
244+
{ path: 'parent/dst/dir/subdir/file' }
240245
])
241-
*/
246+
242247
await helpers.syncAll()
243248
should(await helpers.local.tree()).deepEqual([
244249
'parent/',
@@ -270,39 +275,34 @@ describe('Move', () => {
270275

271276
await helpers.remote.pullChanges()
272277

273-
/* FIXME: Nondeterministic
274-
should(helpers.putDocs('path', '_deleted', 'trashed')).deepEqual([
275-
// file 1/2
276-
{path: path.normalize('parent/src/dir/subdir/file'), _deleted: true},
277-
// file 2/2
278-
{path: path.normalize('parent/dst/dir/subdir/file')},
279-
// dir 2/2
280-
{path: path.normalize('parent/dst/dir')},
281-
// empty-subdir 2/2
282-
{path: path.normalize('parent/dst/dir/empty-subdir')},
283-
// subdir 2/3
284-
{path: path.normalize('parent/dst/dir/subdir')},
285-
// subdir 1/3
286-
{path: path.normalize('parent/src/dir/subdir'), _deleted: true},
287-
{path: path.normalize('parent/src/dir/subdir'), trashed: true},
288-
// empty-subdir 1/2
289-
{path: path.normalize('parent/src/dir/empty-subdir'), _deleted: true},
290-
{path: path.normalize('parent/src/dir/empty-subdir'), trashed: true},
291-
// dir 1/2
292-
{path: path.normalize('parent/src/dir'), _deleted: true},
293-
{path: path.normalize('parent/src/dir'), trashed: true}
278+
should(
279+
helpers.putDocs('path', '_deleted', 'trashed', 'childMove')
280+
).deepEqual([
281+
{ path: path.normalize('parent/src/dir'), _deleted: true },
282+
{ path: path.normalize('parent/dst/dir') },
283+
{
284+
path: path.normalize('parent/src/dir/empty-subdir'),
285+
_deleted: true,
286+
childMove: true
287+
},
288+
{ path: path.normalize('parent/dst/dir/empty-subdir') },
289+
{
290+
path: path.normalize('parent/src/dir/subdir'),
291+
_deleted: true,
292+
childMove: true
293+
},
294+
{ path: path.normalize('parent/dst/dir/subdir') },
295+
{
296+
path: path.normalize('parent/src/dir/subdir/file'),
297+
_deleted: true,
298+
childMove: true
299+
},
300+
{ path: path.normalize('parent/dst/dir/subdir/file') }
294301
])
295-
*/
296302

297303
await helpers.syncAll()
298304

299-
should(
300-
(await helpers.local.tree())
301-
// FIXME: Sometimes a copy of the file ends up in the OS trash.
302-
// Issue was already occurring from time to time, even before we start
303-
// to permanently delete empty dirs.
304-
.filter(path => path !== '/Trash/file')
305-
).deepEqual([
305+
should(await helpers.local.tree()).deepEqual([
306306
'parent/',
307307
'parent/dst/',
308308
'parent/dst/dir/',

0 commit comments

Comments
 (0)