@@ -435,30 +435,48 @@ func TestEditFile(t *testing.T) {
435
435
error : "file path must be absolute" ,
436
436
},
437
437
{
438
- name : "NonExistent" ,
439
- path : filepath .Join (tmpdir , "does-not-exist" ),
438
+ name : "NoEdits" ,
439
+ path : filepath .Join (tmpdir , "no-edits" ),
440
+ contents : "foo bar" ,
441
+ errCode : http .StatusBadRequest ,
442
+ error : "must specify at least one edit" ,
443
+ },
444
+ {
445
+ name : "NonExistent" ,
446
+ path : filepath .Join (tmpdir , "does-not-exist" ),
447
+ edits : []workspacesdk.FileEdit {
448
+ {
449
+ Search : "foo" ,
450
+ Replace : "bar" ,
451
+ },
452
+ },
440
453
errCode : http .StatusNotFound ,
441
454
error : "file does not exist" ,
442
455
},
443
456
{
444
- name : "IsDir" ,
445
- path : dirPath ,
457
+ name : "IsDir" ,
458
+ path : dirPath ,
459
+ edits : []workspacesdk.FileEdit {
460
+ {
461
+ Search : "foo" ,
462
+ Replace : "bar" ,
463
+ },
464
+ },
446
465
errCode : http .StatusBadRequest ,
447
466
error : "not a file" ,
448
467
},
449
468
{
450
- name : "NoPermissions" ,
451
- path : noPermsFilePath ,
469
+ name : "NoPermissions" ,
470
+ path : noPermsFilePath ,
471
+ edits : []workspacesdk.FileEdit {
472
+ {
473
+ Search : "foo" ,
474
+ Replace : "bar" ,
475
+ },
476
+ },
452
477
errCode : http .StatusForbidden ,
453
478
error : "permission denied" ,
454
479
},
455
- {
456
- name : "NoEdits" ,
457
- path : filepath .Join (tmpdir , "no-edits" ),
458
- contents : "foo bar" ,
459
- errCode : http .StatusBadRequest ,
460
- error : "must specify at least one edit" ,
461
- },
462
480
{
463
481
name : "FailRename" ,
464
482
path : failRenameFilePath ,
0 commit comments