feat(workspace): 桌面工作区、主题与交互更新,发布 0.1.2 #13
@@ -7,6 +7,7 @@ import 'package:cutdex/workspace/persistence/recent_projects.dart';
|
||||
import 'package:cutdex/workspace/projects.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
import '../support/memory_app_settings.dart';
|
||||
|
||||
@@ -58,7 +59,7 @@ void main() {
|
||||
project.id,
|
||||
before.timeline!.id,
|
||||
);
|
||||
final manifest = File('${project.path}/manifest.json');
|
||||
final manifest = File(p.join(project.path, 'manifest.json'));
|
||||
final contents = await manifest.readAsString();
|
||||
expect(
|
||||
(await projects.validateNewProjectName(' One '))?.code,
|
||||
@@ -102,7 +103,7 @@ void main() {
|
||||
'creation detects a destination occupied after name validation',
|
||||
() async {
|
||||
expect(await projects.validateNewProjectName('Racing'), isNull);
|
||||
final destination = File('${root.path}/Racing.cutdex');
|
||||
final destination = File(p.join(root.path, 'Racing.cutdex'));
|
||||
await destination.writeAsString('created by another operation');
|
||||
expect(
|
||||
await projects.createProject(
|
||||
@@ -124,16 +125,16 @@ void main() {
|
||||
|
||||
for (final type in ['file', 'directory', 'broken link']) {
|
||||
test('occupied $type is reported without replacing it', () async {
|
||||
final destination = '${root.path}/Occupied.cutdex';
|
||||
final destination = p.join(root.path, 'Occupied.cutdex');
|
||||
switch (type) {
|
||||
case 'file':
|
||||
await File(destination).writeAsString('keep this file');
|
||||
case 'directory':
|
||||
await Directory(destination).create();
|
||||
await File('$destination/keep.txt')
|
||||
await File(p.join(destination, 'keep.txt'))
|
||||
.writeAsString('keep this directory');
|
||||
case 'broken link':
|
||||
await Link(destination).create('${root.path}/missing-target');
|
||||
await Link(destination).create(p.join(root.path, 'missing-target'));
|
||||
}
|
||||
final before = await FileSystemEntity.type(
|
||||
destination,
|
||||
@@ -163,13 +164,13 @@ void main() {
|
||||
expect(await File(destination).readAsString(), 'keep this file');
|
||||
case 'directory':
|
||||
expect(
|
||||
await File('$destination/keep.txt').readAsString(),
|
||||
await File(p.join(destination, 'keep.txt')).readAsString(),
|
||||
'keep this directory',
|
||||
);
|
||||
case 'broken link':
|
||||
expect(
|
||||
await Link(destination).target(),
|
||||
'${root.path}/missing-target',
|
||||
p.join(root.path, 'missing-target'),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user