1- import {test; suite; skip} "mo:test/async" ;
2- import Result "mo:base/Result" ;
3- import Blob "mo:base/Blob" ;
4- import Debug "mo:base/Debug" ;
5- import ExperimentalCycles "mo:base/ExperimentalCycles" ;
1+ // import {test; suite; skip} "mo:test/async";
2+ // import Result "mo:base/Result";
3+ // import Blob "mo:base/Blob";
4+ // import Debug "mo:base/Debug";
5+ // import ExperimentalCycles "mo:base/ExperimentalCycles";
66
7- import Storage "../backend/storage/storage-canister" ;
7+ // import Storage "../backend/storage/storage-canister";
88
9- actor {
10- public func runTests() : async () {
11- ExperimentalCycles . add< system > (1_000_000_000_000 );
12- var storage = await Storage . Storage ();
9+ // actor {
10+ // public func runTests() : async () {
11+ // ExperimentalCycles.add<system>(1_000_000_000_000);
12+ // var storage = await Storage.Storage();
1313
14- let fileId = "test" ;
14+ // let fileId = "test";
1515
16- Debug . print("lalalalalalala" );
16+ // Debug.print("lalalalalalala");
1717
18- // upload
19- await suite("storage upload" , func () : async () {
20- await test("try to finish upload before upload start" , func () : async () {
21- let res = await storage. finishUploads([fileId]);
22- assert Result . isErr(res);
23- });
18+ // // upload
19+ // await suite("storage upload", func() : async () {
20+ // await test("try to finish upload before upload start", func() : async () {
21+ // let res = await storage.finishUploads([fileId]);
22+ // assert Result.isErr(res);
23+ // });
2424
25- await test("try to upload chunk before upload start" , func () : async () {
26- assert Result . isErr(await storage. uploadChunk(fileId, 0 , Blob . fromArray([])));
27- });
25+ // await test("try to upload chunk before upload start", func() : async () {
26+ // assert Result.isErr(await storage.uploadChunk(fileId, 0, Blob.fromArray([])));
27+ // });
2828
29- await test("start upload" , func () : async () {
30- assert Result . isOk(await storage. startUpload({
31- id = fileId;
32- path = "test/test.mo" ;
33- chunkCount = 1 ;
34- owners = [];
35- }));
36- });
29+ // await test("start upload", func() : async () {
30+ // assert Result.isOk(await storage.startUpload({
31+ // id = fileId;
32+ // path = "test/test.mo";
33+ // chunkCount = 1;
34+ // owners = [];
35+ // }));
36+ // });
3737
38- await test("try to finish upload with unknown file id" , func () : async () {
39- assert Result . isErr(await storage. finishUploads([fileId, "unknown-file-id" ]));
40- });
38+ // await test("try to finish upload with unknown file id", func() : async () {
39+ // assert Result.isErr(await storage.finishUploads([fileId, "unknown-file-id"]));
40+ // });
4141
42- await test("finish upload" , func () : async () {
43- assert Result . isOk(await storage. finishUploads([fileId]));
44- });
42+ // await test("finish upload", func() : async () {
43+ // assert Result.isOk(await storage.finishUploads([fileId]));
44+ // });
4545
46- await test("try to finish already finished upload" , func () : async () {
47- assert Result . isErr(await storage. finishUploads([fileId]));
48- });
46+ // await test("try to finish already finished upload", func() : async () {
47+ // assert Result.isErr(await storage.finishUploads([fileId]));
48+ // });
4949
50- await test("try to start upload existing file" , func () : async () {
51- assert Result . isErr(await storage. startUpload({
52- id = fileId;
53- path = "test/test.mo" ;
54- chunkCount = 1 ;
55- owners = [];
56- }));
57- });
58- });
50+ // await test("try to start upload existing file", func() : async () {
51+ // assert Result.isErr(await storage.startUpload({
52+ // id = fileId;
53+ // path = "test/test.mo";
54+ // chunkCount = 1;
55+ // owners = [];
56+ // }));
57+ // });
58+ // });
5959
60- // download
61- await suite("storage download" , func () : async () {
62- await test("get file meta" , func () : async () {
63- let res = await storage. getFileMeta(fileId);
64- assert Result . isOk(res);
65- switch (res) {
66- case (#ok(fileMeta)) {
67- assert fileMeta. path == "test/test.mo" ;
68- assert fileMeta. chunkCount == 1 ;
69- assert fileMeta. owners == [];
70- };
71- case (_) {};
72- };
73- });
60+ // // download
61+ // await suite("storage download", func() : async () {
62+ // await test("get file meta", func() : async () {
63+ // let res = await storage.getFileMeta(fileId);
64+ // assert Result.isOk(res);
65+ // switch (res) {
66+ // case (#ok(fileMeta)) {
67+ // assert fileMeta.path == "test/test.mo";
68+ // assert fileMeta.chunkCount == 1;
69+ // assert fileMeta.owners == [];
70+ // };
71+ // case (_) {};
72+ // };
73+ // });
7474
75- await test("try to get file meta of unknown file" , func () : async () {
76- let res = await storage. getFileMeta("123" );
77- assert Result . isErr(res);
78- });
75+ // await test("try to get file meta of unknown file", func() : async () {
76+ // let res = await storage.getFileMeta("123");
77+ // assert Result.isErr(res);
78+ // });
7979
80- await test("upgrade storage canister" , func () : async () {
81- storage := await (system Storage . Storage )(#upgrade(storage))();
82- });
80+ // await test("upgrade storage canister", func() : async () {
81+ // storage := await (system Storage.Storage)(#upgrade(storage))();
82+ // });
8383
84- await test("get file meta after upgrade" , func () : async () {
85- let res = await storage. getFileMeta(fileId);
86- assert Result . isOk(res);
87- switch (res) {
88- case (#ok(fileMeta)) {
89- assert fileMeta. path == "test/test.mo" ;
90- assert fileMeta. chunkCount == 1 ;
91- assert fileMeta. owners == [];
92- };
93- case (_) {};
94- };
95- });
96- });
97- };
98- };
84+ // await test("get file meta after upgrade", func() : async () {
85+ // let res = await storage.getFileMeta(fileId);
86+ // assert Result.isOk(res);
87+ // switch (res) {
88+ // case (#ok(fileMeta)) {
89+ // assert fileMeta.path == "test/test.mo";
90+ // assert fileMeta.chunkCount == 1;
91+ // assert fileMeta.owners == [];
92+ // };
93+ // case (_) {};
94+ // };
95+ // });
96+ // });
97+ // };
98+ // };
0 commit comments