mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-02-02 06:46:22 +01:00
Fix incorrect test cases
Path never begins with / in practice
This commit is contained in:
parent
ff85c0caba
commit
275603d88a
2 changed files with 77 additions and 77 deletions
|
@ -46,7 +46,7 @@ void main() {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"content": <String, dynamic>{
|
"content": <String, dynamic>{
|
||||||
"file": <String, dynamic>{
|
"file": <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test1.jpg",
|
"path": "remote.php/dav/files/admin/test1.jpg",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -54,7 +54,7 @@ void main() {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"content": <String, dynamic>{
|
"content": <String, dynamic>{
|
||||||
"file": <String, dynamic>{
|
"file": <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test2.jpg",
|
"path": "remote.php/dav/files/admin/test2.jpg",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -67,10 +67,10 @@ void main() {
|
||||||
name: "",
|
name: "",
|
||||||
items: [
|
items: [
|
||||||
AlbumFileItem(
|
AlbumFileItem(
|
||||||
file: File(path: "/remote.php/dav/files/admin/test1.jpg"),
|
file: File(path: "remote.php/dav/files/admin/test1.jpg"),
|
||||||
),
|
),
|
||||||
AlbumFileItem(
|
AlbumFileItem(
|
||||||
file: File(path: "/remote.php/dav/files/admin/test2.jpg"),
|
file: File(path: "remote.php/dav/files/admin/test2.jpg"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
|
@ -82,7 +82,7 @@ void main() {
|
||||||
"lastUpdated": "2020-01-02T03:04:05.678901Z",
|
"lastUpdated": "2020-01-02T03:04:05.678901Z",
|
||||||
"items": [],
|
"items": [],
|
||||||
"albumFile": <String, dynamic>{
|
"albumFile": <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test1.jpg",
|
"path": "remote.php/dav/files/admin/test1.jpg",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
expect(
|
expect(
|
||||||
|
@ -91,7 +91,7 @@ void main() {
|
||||||
lastUpdated: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901),
|
lastUpdated: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901),
|
||||||
name: "",
|
name: "",
|
||||||
items: [],
|
items: [],
|
||||||
albumFile: File(path: "/remote.php/dav/files/admin/test1.jpg"),
|
albumFile: File(path: "remote.php/dav/files/admin/test1.jpg"),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -131,10 +131,10 @@ void main() {
|
||||||
name: "",
|
name: "",
|
||||||
items: [
|
items: [
|
||||||
AlbumFileItem(
|
AlbumFileItem(
|
||||||
file: File(path: "/remote.php/dav/files/admin/test1.jpg"),
|
file: File(path: "remote.php/dav/files/admin/test1.jpg"),
|
||||||
),
|
),
|
||||||
AlbumFileItem(
|
AlbumFileItem(
|
||||||
file: File(path: "/remote.php/dav/files/admin/test2.jpg"),
|
file: File(path: "remote.php/dav/files/admin/test2.jpg"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -147,7 +147,7 @@ void main() {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"content": <String, dynamic>{
|
"content": <String, dynamic>{
|
||||||
"file": <String, dynamic>{
|
"file": <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test1.jpg",
|
"path": "remote.php/dav/files/admin/test1.jpg",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -155,7 +155,7 @@ void main() {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"content": <String, dynamic>{
|
"content": <String, dynamic>{
|
||||||
"file": <String, dynamic>{
|
"file": <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test2.jpg",
|
"path": "remote.php/dav/files/admin/test2.jpg",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -199,10 +199,10 @@ void main() {
|
||||||
name: "",
|
name: "",
|
||||||
items: [
|
items: [
|
||||||
AlbumFileItem(
|
AlbumFileItem(
|
||||||
file: File(path: "/remote.php/dav/files/admin/test1.jpg"),
|
file: File(path: "remote.php/dav/files/admin/test1.jpg"),
|
||||||
),
|
),
|
||||||
AlbumFileItem(
|
AlbumFileItem(
|
||||||
file: File(path: "/remote.php/dav/files/admin/test2.jpg"),
|
file: File(path: "remote.php/dav/files/admin/test2.jpg"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@ -215,7 +215,7 @@ void main() {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"content": <String, dynamic>{
|
"content": <String, dynamic>{
|
||||||
"file": <String, dynamic>{
|
"file": <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test1.jpg",
|
"path": "remote.php/dav/files/admin/test1.jpg",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -223,7 +223,7 @@ void main() {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"content": <String, dynamic>{
|
"content": <String, dynamic>{
|
||||||
"file": <String, dynamic>{
|
"file": <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test2.jpg",
|
"path": "remote.php/dav/files/admin/test2.jpg",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -236,7 +236,7 @@ void main() {
|
||||||
lastUpdated: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901),
|
lastUpdated: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901),
|
||||||
name: "",
|
name: "",
|
||||||
items: [],
|
items: [],
|
||||||
albumFile: File(path: "/remote.php/dav/files/admin/test1.jpg"),
|
albumFile: File(path: "remote.php/dav/files/admin/test1.jpg"),
|
||||||
);
|
);
|
||||||
expect(album.toAppDbJson(), <String, dynamic>{
|
expect(album.toAppDbJson(), <String, dynamic>{
|
||||||
"version": Album.version,
|
"version": Album.version,
|
||||||
|
@ -244,7 +244,7 @@ void main() {
|
||||||
"name": "",
|
"name": "",
|
||||||
"items": [],
|
"items": [],
|
||||||
"albumFile": <String, dynamic>{
|
"albumFile": <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test1.jpg",
|
"path": "remote.php/dav/files/admin/test1.jpg",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -258,13 +258,13 @@ void main() {
|
||||||
name: "album",
|
name: "album",
|
||||||
items: [
|
items: [
|
||||||
AlbumFileItem(
|
AlbumFileItem(
|
||||||
file: File(path: "/remote.php/dav/files/admin/test1.jpg"),
|
file: File(path: "remote.php/dav/files/admin/test1.jpg"),
|
||||||
),
|
),
|
||||||
AlbumFileItem(
|
AlbumFileItem(
|
||||||
file: File(path: "/remote.php/dav/files/admin/test2.jpg"),
|
file: File(path: "remote.php/dav/files/admin/test2.jpg"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
albumFile: File(path: "/remote.php/dav/files/admin/test1.jpg"),
|
albumFile: File(path: "remote.php/dav/files/admin/test1.jpg"),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
album,
|
album,
|
||||||
|
@ -272,7 +272,7 @@ void main() {
|
||||||
lastUpdated: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901),
|
lastUpdated: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901),
|
||||||
name: "album",
|
name: "album",
|
||||||
items: [],
|
items: [],
|
||||||
albumFile: File(path: "/remote.php/dav/files/admin/test1.jpg"),
|
albumFile: File(path: "remote.php/dav/files/admin/test1.jpg"),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -283,13 +283,13 @@ void main() {
|
||||||
name: "album",
|
name: "album",
|
||||||
items: [
|
items: [
|
||||||
AlbumFileItem(
|
AlbumFileItem(
|
||||||
file: File(path: "/remote.php/dav/files/admin/test1.jpg"),
|
file: File(path: "remote.php/dav/files/admin/test1.jpg"),
|
||||||
),
|
),
|
||||||
AlbumFileItem(
|
AlbumFileItem(
|
||||||
file: File(path: "/remote.php/dav/files/admin/test2.jpg"),
|
file: File(path: "remote.php/dav/files/admin/test2.jpg"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
albumFile: File(path: "/remote.php/dav/files/admin/test1.jpg"),
|
albumFile: File(path: "remote.php/dav/files/admin/test1.jpg"),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
album,
|
album,
|
||||||
|
@ -298,13 +298,13 @@ void main() {
|
||||||
name: "album",
|
name: "album",
|
||||||
items: [
|
items: [
|
||||||
AlbumFileItem(
|
AlbumFileItem(
|
||||||
file: File(path: "/remote.php/dav/files/admin/test1.jpg"),
|
file: File(path: "remote.php/dav/files/admin/test1.jpg"),
|
||||||
),
|
),
|
||||||
AlbumFileItem(
|
AlbumFileItem(
|
||||||
file: File(path: "/remote.php/dav/files/admin/test2.jpg"),
|
file: File(path: "remote.php/dav/files/admin/test2.jpg"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
albumFile: File(path: "/remote.php/dav/files/admin/test1.jpg"),
|
albumFile: File(path: "remote.php/dav/files/admin/test1.jpg"),
|
||||||
));
|
));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,11 +7,11 @@ void main() {
|
||||||
group("compareFileDateTimeDescending", () {
|
group("compareFileDateTimeDescending", () {
|
||||||
test("lastModified a>b", () {
|
test("lastModified a>b", () {
|
||||||
final a = File(
|
final a = File(
|
||||||
path: "/remote.php/dav/files/admin/test1.jpg",
|
path: "remote.php/dav/files/admin/test1.jpg",
|
||||||
lastModified: DateTime.utc(2021),
|
lastModified: DateTime.utc(2021),
|
||||||
);
|
);
|
||||||
final b = File(
|
final b = File(
|
||||||
path: "/remote.php/dav/files/admin/test2.jpg",
|
path: "remote.php/dav/files/admin/test2.jpg",
|
||||||
lastModified: DateTime.utc(2020),
|
lastModified: DateTime.utc(2020),
|
||||||
);
|
);
|
||||||
expect(compareFileDateTimeDescending(a, b), lessThan(0));
|
expect(compareFileDateTimeDescending(a, b), lessThan(0));
|
||||||
|
@ -19,11 +19,11 @@ void main() {
|
||||||
|
|
||||||
test("lastModified a<b", () {
|
test("lastModified a<b", () {
|
||||||
final a = File(
|
final a = File(
|
||||||
path: "/remote.php/dav/files/admin/test1.jpg",
|
path: "remote.php/dav/files/admin/test1.jpg",
|
||||||
lastModified: DateTime.utc(2020),
|
lastModified: DateTime.utc(2020),
|
||||||
);
|
);
|
||||||
final b = File(
|
final b = File(
|
||||||
path: "/remote.php/dav/files/admin/test2.jpg",
|
path: "remote.php/dav/files/admin/test2.jpg",
|
||||||
lastModified: DateTime.utc(2021),
|
lastModified: DateTime.utc(2021),
|
||||||
);
|
);
|
||||||
expect(compareFileDateTimeDescending(a, b), greaterThan(0));
|
expect(compareFileDateTimeDescending(a, b), greaterThan(0));
|
||||||
|
@ -31,11 +31,11 @@ void main() {
|
||||||
|
|
||||||
test("lastModified a==b", () {
|
test("lastModified a==b", () {
|
||||||
final a = File(
|
final a = File(
|
||||||
path: "/remote.php/dav/files/admin/test1.jpg",
|
path: "remote.php/dav/files/admin/test1.jpg",
|
||||||
lastModified: DateTime.utc(2021),
|
lastModified: DateTime.utc(2021),
|
||||||
);
|
);
|
||||||
final b = File(
|
final b = File(
|
||||||
path: "/remote.php/dav/files/admin/test2.jpg",
|
path: "remote.php/dav/files/admin/test2.jpg",
|
||||||
lastModified: DateTime.utc(2021),
|
lastModified: DateTime.utc(2021),
|
||||||
);
|
);
|
||||||
expect(compareFileDateTimeDescending(a, b), lessThan(0));
|
expect(compareFileDateTimeDescending(a, b), lessThan(0));
|
||||||
|
@ -43,7 +43,7 @@ void main() {
|
||||||
|
|
||||||
test("exif a>b", () {
|
test("exif a>b", () {
|
||||||
final a = File(
|
final a = File(
|
||||||
path: "/remote.php/dav/files/admin/test1.jpg",
|
path: "remote.php/dav/files/admin/test1.jpg",
|
||||||
metadata: Metadata(
|
metadata: Metadata(
|
||||||
exif: Exif({
|
exif: Exif({
|
||||||
"DateTimeOriginal": "2021:01:02 03:04:05",
|
"DateTimeOriginal": "2021:01:02 03:04:05",
|
||||||
|
@ -51,7 +51,7 @@ void main() {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final b = File(
|
final b = File(
|
||||||
path: "/remote.php/dav/files/admin/test2.jpg",
|
path: "remote.php/dav/files/admin/test2.jpg",
|
||||||
metadata: Metadata(
|
metadata: Metadata(
|
||||||
exif: Exif({
|
exif: Exif({
|
||||||
"DateTimeOriginal": "2020:01:02 03:04:05",
|
"DateTimeOriginal": "2020:01:02 03:04:05",
|
||||||
|
@ -63,7 +63,7 @@ void main() {
|
||||||
|
|
||||||
test("exif a<b", () {
|
test("exif a<b", () {
|
||||||
final a = File(
|
final a = File(
|
||||||
path: "/remote.php/dav/files/admin/test1.jpg",
|
path: "remote.php/dav/files/admin/test1.jpg",
|
||||||
metadata: Metadata(
|
metadata: Metadata(
|
||||||
exif: Exif({
|
exif: Exif({
|
||||||
"DateTimeOriginal": "2020:01:02 03:04:05",
|
"DateTimeOriginal": "2020:01:02 03:04:05",
|
||||||
|
@ -71,7 +71,7 @@ void main() {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final b = File(
|
final b = File(
|
||||||
path: "/remote.php/dav/files/admin/test2.jpg",
|
path: "remote.php/dav/files/admin/test2.jpg",
|
||||||
metadata: Metadata(
|
metadata: Metadata(
|
||||||
exif: Exif({
|
exif: Exif({
|
||||||
"DateTimeOriginal": "2021:01:02 03:04:05",
|
"DateTimeOriginal": "2021:01:02 03:04:05",
|
||||||
|
@ -83,7 +83,7 @@ void main() {
|
||||||
|
|
||||||
test("exif a==b", () {
|
test("exif a==b", () {
|
||||||
final a = File(
|
final a = File(
|
||||||
path: "/remote.php/dav/files/admin/test1.jpg",
|
path: "remote.php/dav/files/admin/test1.jpg",
|
||||||
metadata: Metadata(
|
metadata: Metadata(
|
||||||
exif: Exif({
|
exif: Exif({
|
||||||
"DateTimeOriginal": "2021:01:02 03:04:05",
|
"DateTimeOriginal": "2021:01:02 03:04:05",
|
||||||
|
@ -91,7 +91,7 @@ void main() {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
final b = File(
|
final b = File(
|
||||||
path: "/remote.php/dav/files/admin/test2.jpg",
|
path: "remote.php/dav/files/admin/test2.jpg",
|
||||||
metadata: Metadata(
|
metadata: Metadata(
|
||||||
exif: Exif({
|
exif: Exif({
|
||||||
"DateTimeOriginal": "2021:01:02 03:04:05",
|
"DateTimeOriginal": "2021:01:02 03:04:05",
|
||||||
|
@ -330,10 +330,10 @@ void main() {
|
||||||
group("fromJson", () {
|
group("fromJson", () {
|
||||||
test("path", () {
|
test("path", () {
|
||||||
final json = <String, dynamic>{
|
final json = <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test.jpg",
|
"path": "remote.php/dav/files/admin/test.jpg",
|
||||||
};
|
};
|
||||||
final file = File.fromJson(json);
|
final file = File.fromJson(json);
|
||||||
expect(file, File(path: "/remote.php/dav/files/admin/test.jpg"));
|
expect(file, File(path: "remote.php/dav/files/admin/test.jpg"));
|
||||||
});
|
});
|
||||||
|
|
||||||
test("contentLength", () {
|
test("contentLength", () {
|
||||||
|
@ -435,95 +435,95 @@ void main() {
|
||||||
|
|
||||||
group("toJson", () {
|
group("toJson", () {
|
||||||
test("path", () {
|
test("path", () {
|
||||||
final file = File(path: "/remote.php/dav/files/admin/test.jpg");
|
final file = File(path: "remote.php/dav/files/admin/test.jpg");
|
||||||
expect(file.toJson(), <String, dynamic>{
|
expect(file.toJson(), <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test.jpg",
|
"path": "remote.php/dav/files/admin/test.jpg",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("contentLength", () {
|
test("contentLength", () {
|
||||||
final file = File(
|
final file = File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg", contentLength: 123);
|
path: "remote.php/dav/files/admin/test.jpg", contentLength: 123);
|
||||||
expect(file.toJson(), <String, dynamic>{
|
expect(file.toJson(), <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test.jpg",
|
"path": "remote.php/dav/files/admin/test.jpg",
|
||||||
"contentLength": 123,
|
"contentLength": 123,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("contentType", () {
|
test("contentType", () {
|
||||||
final file = File(
|
final file = File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentType: "image/jpeg");
|
contentType: "image/jpeg");
|
||||||
expect(file.toJson(), <String, dynamic>{
|
expect(file.toJson(), <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test.jpg",
|
"path": "remote.php/dav/files/admin/test.jpg",
|
||||||
"contentType": "image/jpeg",
|
"contentType": "image/jpeg",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("etag", () {
|
test("etag", () {
|
||||||
final file = File(
|
final file = File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5");
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5");
|
||||||
expect(file.toJson(), <String, dynamic>{
|
expect(file.toJson(), <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test.jpg",
|
"path": "remote.php/dav/files/admin/test.jpg",
|
||||||
"etag": "8a3e0799b6f0711c23cc2d93950eceb5",
|
"etag": "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("lastModified", () {
|
test("lastModified", () {
|
||||||
final file = File(
|
final file = File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
lastModified: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901));
|
lastModified: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901));
|
||||||
expect(file.toJson(), <String, dynamic>{
|
expect(file.toJson(), <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test.jpg",
|
"path": "remote.php/dav/files/admin/test.jpg",
|
||||||
"lastModified": "2020-01-02T03:04:05.678901Z",
|
"lastModified": "2020-01-02T03:04:05.678901Z",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("isCollection", () {
|
test("isCollection", () {
|
||||||
final file = File(
|
final file = File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg", isCollection: true);
|
path: "remote.php/dav/files/admin/test.jpg", isCollection: true);
|
||||||
expect(file.toJson(), <String, dynamic>{
|
expect(file.toJson(), <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test.jpg",
|
"path": "remote.php/dav/files/admin/test.jpg",
|
||||||
"isCollection": true,
|
"isCollection": true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("usedBytes", () {
|
test("usedBytes", () {
|
||||||
final file = File(
|
final file = File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg", usedBytes: 123456);
|
path: "remote.php/dav/files/admin/test.jpg", usedBytes: 123456);
|
||||||
expect(file.toJson(), <String, dynamic>{
|
expect(file.toJson(), <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test.jpg",
|
"path": "remote.php/dav/files/admin/test.jpg",
|
||||||
"usedBytes": 123456,
|
"usedBytes": 123456,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("hasPreview", () {
|
test("hasPreview", () {
|
||||||
final file = File(
|
final file = File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg", hasPreview: true);
|
path: "remote.php/dav/files/admin/test.jpg", hasPreview: true);
|
||||||
expect(file.toJson(), <String, dynamic>{
|
expect(file.toJson(), <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test.jpg",
|
"path": "remote.php/dav/files/admin/test.jpg",
|
||||||
"hasPreview": true,
|
"hasPreview": true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("fileId", () {
|
test("fileId", () {
|
||||||
final file =
|
final file =
|
||||||
File(path: "/remote.php/dav/files/admin/test.jpg", fileId: 123);
|
File(path: "remote.php/dav/files/admin/test.jpg", fileId: 123);
|
||||||
expect(file.toJson(), <String, dynamic>{
|
expect(file.toJson(), <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test.jpg",
|
"path": "remote.php/dav/files/admin/test.jpg",
|
||||||
"fileId": 123,
|
"fileId": 123,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("metadata", () {
|
test("metadata", () {
|
||||||
final file = File(
|
final file = File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
metadata: Metadata(
|
metadata: Metadata(
|
||||||
lastUpdated: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901),
|
lastUpdated: DateTime.utc(2020, 1, 2, 3, 4, 5, 678, 901),
|
||||||
));
|
));
|
||||||
expect(file.toJson(), <String, dynamic>{
|
expect(file.toJson(), <String, dynamic>{
|
||||||
"path": "/remote.php/dav/files/admin/test.jpg",
|
"path": "remote.php/dav/files/admin/test.jpg",
|
||||||
"metadata": <String, dynamic>{
|
"metadata": <String, dynamic>{
|
||||||
"version": Metadata.version,
|
"version": Metadata.version,
|
||||||
"lastUpdated": "2020-01-02T03:04:05.678901Z",
|
"lastUpdated": "2020-01-02T03:04:05.678901Z",
|
||||||
|
@ -534,7 +534,7 @@ void main() {
|
||||||
|
|
||||||
group("copyWith", () {
|
group("copyWith", () {
|
||||||
final src = File(
|
final src = File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentLength: 123,
|
contentLength: 123,
|
||||||
contentType: "image/jpeg",
|
contentType: "image/jpeg",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
@ -547,11 +547,11 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
test("path", () {
|
test("path", () {
|
||||||
final file = src.copyWith(path: "/remote.php/dav/files/admin/test.png");
|
final file = src.copyWith(path: "remote.php/dav/files/admin/test.png");
|
||||||
expect(
|
expect(
|
||||||
file,
|
file,
|
||||||
File(
|
File(
|
||||||
path: "/remote.php/dav/files/admin/test.png",
|
path: "remote.php/dav/files/admin/test.png",
|
||||||
contentLength: 123,
|
contentLength: 123,
|
||||||
contentType: "image/jpeg",
|
contentType: "image/jpeg",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
@ -568,7 +568,7 @@ void main() {
|
||||||
expect(
|
expect(
|
||||||
file,
|
file,
|
||||||
File(
|
File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentLength: 321,
|
contentLength: 321,
|
||||||
contentType: "image/jpeg",
|
contentType: "image/jpeg",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
@ -585,7 +585,7 @@ void main() {
|
||||||
expect(
|
expect(
|
||||||
file,
|
file,
|
||||||
File(
|
File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentLength: 123,
|
contentLength: 123,
|
||||||
contentType: "image/png",
|
contentType: "image/png",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
@ -602,7 +602,7 @@ void main() {
|
||||||
expect(
|
expect(
|
||||||
file,
|
file,
|
||||||
File(
|
File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentLength: 123,
|
contentLength: 123,
|
||||||
contentType: "image/jpeg",
|
contentType: "image/jpeg",
|
||||||
etag: "000",
|
etag: "000",
|
||||||
|
@ -620,7 +620,7 @@ void main() {
|
||||||
expect(
|
expect(
|
||||||
file,
|
file,
|
||||||
File(
|
File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentLength: 123,
|
contentLength: 123,
|
||||||
contentType: "image/jpeg",
|
contentType: "image/jpeg",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
@ -637,7 +637,7 @@ void main() {
|
||||||
expect(
|
expect(
|
||||||
file,
|
file,
|
||||||
File(
|
File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentLength: 123,
|
contentLength: 123,
|
||||||
contentType: "image/jpeg",
|
contentType: "image/jpeg",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
@ -654,7 +654,7 @@ void main() {
|
||||||
expect(
|
expect(
|
||||||
file,
|
file,
|
||||||
File(
|
File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentLength: 123,
|
contentLength: 123,
|
||||||
contentType: "image/jpeg",
|
contentType: "image/jpeg",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
@ -671,7 +671,7 @@ void main() {
|
||||||
expect(
|
expect(
|
||||||
file,
|
file,
|
||||||
File(
|
File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentLength: 123,
|
contentLength: 123,
|
||||||
contentType: "image/jpeg",
|
contentType: "image/jpeg",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
@ -688,7 +688,7 @@ void main() {
|
||||||
expect(
|
expect(
|
||||||
file,
|
file,
|
||||||
File(
|
File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentLength: 123,
|
contentLength: 123,
|
||||||
contentType: "image/jpeg",
|
contentType: "image/jpeg",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
@ -706,7 +706,7 @@ void main() {
|
||||||
expect(
|
expect(
|
||||||
file,
|
file,
|
||||||
File(
|
File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentLength: 123,
|
contentLength: 123,
|
||||||
contentType: "image/jpeg",
|
contentType: "image/jpeg",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
@ -721,7 +721,7 @@ void main() {
|
||||||
|
|
||||||
test("clear metadata", () {
|
test("clear metadata", () {
|
||||||
final src = File(
|
final src = File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentLength: 123,
|
contentLength: 123,
|
||||||
contentType: "image/jpeg",
|
contentType: "image/jpeg",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
@ -736,7 +736,7 @@ void main() {
|
||||||
expect(
|
expect(
|
||||||
file,
|
file,
|
||||||
File(
|
File(
|
||||||
path: "/remote.php/dav/files/admin/test.jpg",
|
path: "remote.php/dav/files/admin/test.jpg",
|
||||||
contentLength: 123,
|
contentLength: 123,
|
||||||
contentType: "image/jpeg",
|
contentType: "image/jpeg",
|
||||||
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
etag: "8a3e0799b6f0711c23cc2d93950eceb5",
|
||||||
|
@ -751,12 +751,12 @@ void main() {
|
||||||
|
|
||||||
group("strippedPath", () {
|
group("strippedPath", () {
|
||||||
test("file", () {
|
test("file", () {
|
||||||
final file = File(path: "/remote.php/dav/files/admin/test.jpg");
|
final file = File(path: "remote.php/dav/files/admin/test.jpg");
|
||||||
expect(file.strippedPath, "admin/test.jpg");
|
expect(file.strippedPath, "test.jpg");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("root dir", () {
|
test("root dir", () {
|
||||||
final file = File(path: "/remote.php/dav/files/admin");
|
final file = File(path: "remote.php/dav/files/admin");
|
||||||
expect(file.strippedPath, ".");
|
expect(file.strippedPath, ".");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue