Skip to content

Commit a4a76f1

Browse files
committed
Merge branch 'main' into sns
2 parents f9876b9 + 35050a1 commit a4a76f1

3 files changed

Lines changed: 85 additions & 84 deletions

File tree

.github/workflows/mops-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
node-version: ${{ matrix.node-version }}
3232
cache: 'npm'
3333
- uses: dfinity/setup-dfx@main
34+
- run: dfx cache install
3435
- name: Cache mops packages
3536
uses: actions/cache@v4
3637
with:

backend/main/verifyPackageRepository.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import Types "./types";
1616
module {
1717
public func verifyPackageRepository(packageName : Types.PackageName, repositoryUrl : Text, transform : IC.Transform) : async Result.Result<(), Text> {
1818
if (repositoryUrl == "") {
19-
return #ok;
19+
return #err("Package repository URL missing. Add a \"repository\" entry to the mops.toml file in the [package] section.");
2020
};
2121

2222
if (not Text.startsWith(repositoryUrl, #text("https://github.com/"))) {

test/storage-actor.test.mo

Lines changed: 83 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,98 @@
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

Comments
 (0)