test(projects): use native paths for creation collision assertions
Gitea CI / Check code and tests (pull_request) Successful in 6m36s
Gitea CI / Assemble and validate CI artifacts (pull_request) Successful in 45s
Gitea CI / Gitea CI passed (pull_request) Successful in 2s
Gitea CI / Build Windows x64 app (pull_request) Successful in 2m53s
Gitea CI / Audit and package Windows x64 (pull_request) Successful in 1m23s
Gitea CI / Build Android APK (pull_request) Successful in 4m42s
Gitea CI / Check code and tests (pull_request) Successful in 6m36s
Gitea CI / Assemble and validate CI artifacts (pull_request) Successful in 45s
Gitea CI / Gitea CI passed (pull_request) Successful in 2s
Gitea CI / Build Windows x64 app (pull_request) Successful in 2m53s
Gitea CI / Audit and package Windows x64 (pull_request) Successful in 1m23s
Gitea CI / Build Android APK (pull_request) Successful in 4m42s
This commit is contained in:
1 parent
2e0033ce2d
commit
9c69a61535
1 file changed
+8
-7
@@ -7,6 +7,7 @@ import 'package:cutdex/workspace/persistence/recent_projects.dart';
|
|||||||
import 'package:cutdex/workspace/projects.dart';
|
import 'package:cutdex/workspace/projects.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:path/path.dart' as p;
|
||||||
|
|
||||||
import '../support/memory_app_settings.dart';
|
import '../support/memory_app_settings.dart';
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ void main() {
|
|||||||
project.id,
|
project.id,
|
||||||
before.timeline!.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();
|
final contents = await manifest.readAsString();
|
||||||
expect(
|
expect(
|
||||||
(await projects.validateNewProjectName(' One '))?.code,
|
(await projects.validateNewProjectName(' One '))?.code,
|
||||||
@@ -102,7 +103,7 @@ void main() {
|
|||||||
'creation detects a destination occupied after name validation',
|
'creation detects a destination occupied after name validation',
|
||||||
() async {
|
() async {
|
||||||
expect(await projects.validateNewProjectName('Racing'), isNull);
|
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');
|
await destination.writeAsString('created by another operation');
|
||||||
expect(
|
expect(
|
||||||
await projects.createProject(
|
await projects.createProject(
|
||||||
@@ -124,16 +125,16 @@ void main() {
|
|||||||
|
|
||||||
for (final type in ['file', 'directory', 'broken link']) {
|
for (final type in ['file', 'directory', 'broken link']) {
|
||||||
test('occupied $type is reported without replacing it', () async {
|
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) {
|
switch (type) {
|
||||||
case 'file':
|
case 'file':
|
||||||
await File(destination).writeAsString('keep this file');
|
await File(destination).writeAsString('keep this file');
|
||||||
case 'directory':
|
case 'directory':
|
||||||
await Directory(destination).create();
|
await Directory(destination).create();
|
||||||
await File('$destination/keep.txt')
|
await File(p.join(destination, 'keep.txt'))
|
||||||
.writeAsString('keep this directory');
|
.writeAsString('keep this directory');
|
||||||
case 'broken link':
|
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(
|
final before = await FileSystemEntity.type(
|
||||||
destination,
|
destination,
|
||||||
@@ -163,13 +164,13 @@ void main() {
|
|||||||
expect(await File(destination).readAsString(), 'keep this file');
|
expect(await File(destination).readAsString(), 'keep this file');
|
||||||
case 'directory':
|
case 'directory':
|
||||||
expect(
|
expect(
|
||||||
await File('$destination/keep.txt').readAsString(),
|
await File(p.join(destination, 'keep.txt')).readAsString(),
|
||||||
'keep this directory',
|
'keep this directory',
|
||||||
);
|
);
|
||||||
case 'broken link':
|
case 'broken link':
|
||||||
expect(
|
expect(
|
||||||
await Link(destination).target(),
|
await Link(destination).target(),
|
||||||
'${root.path}/missing-target',
|
p.join(root.path, 'missing-target'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user