Skip to content

Commit 0e75985

Browse files
committed
wip
1 parent 4774d39 commit 0e75985

File tree

3 files changed

+19
-49
lines changed

3 files changed

+19
-49
lines changed

packages/tools/package.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ Package.onUse(function(api) {
1010
});
1111

1212
Package.onTest(function(api) {
13-
api.use('ecmascript');
14-
api.use('typescript');
1513
api.use('tinytest');
16-
api.use('tools');
14+
api.use('typescript');
1715
api.mainModule('tools-tests.ts', 'server');
1816
});

packages/tools/tools-tests.ts

Lines changed: 18 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,33 @@
11
import { Tinytest } from "meteor/tinytest";
22

33
// Type compilation tests for meteor/tools
4-
// These tests verify that TypeScript types are correctly defined.
5-
// If this file compiles without errors, the types are correct.
64

7-
// Import types to verify they exist
8-
import type { Assets, Npm, Package, App, Cordova, PackageAPI } from "meteor/tools";
9-
10-
// ============================================================================
11-
// Assets type tests (runtime global)
12-
// ============================================================================
13-
14-
Tinytest.add("tools types - Assets.getTextAsync returns Promise<string>", (test) => {
15-
// Type assertion: getTextAsync should return Promise<string>
16-
const getTextAsync: Assets["getTextAsync"] = Assets.getTextAsync;
17-
test.isTrue(typeof getTextAsync === "function", "Assets.getTextAsync should be a function");
5+
Tinytest.add("tools types - Assets.getTextAsync is a function", (test) => {
6+
test.isTrue(
7+
typeof Assets.getTextAsync === "function",
8+
"Assets.getTextAsync should be a function"
9+
);
1810
});
1911

20-
Tinytest.add("tools types - Assets.getBinaryAsync returns Promise<Uint8Array>", (test) => {
21-
// Type assertion: getBinaryAsync should return Promise<Uint8Array>
22-
const getBinaryAsync: Assets["getBinaryAsync"] = Assets.getBinaryAsync;
23-
test.isTrue(typeof getBinaryAsync === "function", "Assets.getBinaryAsync should be a function");
12+
Tinytest.add("tools types - Assets.getBinaryAsync is a function", (test) => {
13+
test.isTrue(
14+
typeof Assets.getBinaryAsync === "function",
15+
"Assets.getBinaryAsync should be a function"
16+
);
2417
});
2518

2619
Tinytest.add("tools types - Assets.absoluteFilePath returns string", (test) => {
2720
const result = Assets.absoluteFilePath("test.txt");
28-
test.isTrue(typeof result === "string", "Assets.absoluteFilePath should return a string");
21+
test.isTrue(
22+
typeof result === "string",
23+
"Assets.absoluteFilePath should return a string"
24+
);
2925
});
3026

3127
Tinytest.add("tools types - Assets.getServerDir returns string", (test) => {
3228
const result = Assets.getServerDir();
33-
test.isTrue(typeof result === "string", "Assets.getServerDir should return a string");
29+
test.isTrue(
30+
typeof result === "string",
31+
"Assets.getServerDir should return a string"
32+
);
3433
});
35-
36-
// ============================================================================
37-
// Type-level tests (compilation only, no runtime execution)
38-
// These are compile-time assertions that verify type correctness.
39-
// ============================================================================
40-
41-
// Test that PackageAPI interface has expected methods
42-
type TestPackageAPI = {
43-
versionsFrom: PackageAPI["versionsFrom"];
44-
use: PackageAPI["use"];
45-
imply: PackageAPI["imply"];
46-
export: PackageAPI["export"];
47-
addFiles: PackageAPI["addFiles"];
48-
addAssets: PackageAPI["addAssets"];
49-
mainModule: PackageAPI["mainModule"];
50-
};
51-
52-
// Type-level assertion: this will fail to compile if PackageAPI is missing methods
53-
const _typeTest: TestPackageAPI = {} as PackageAPI;
54-
55-
// Verify global declarations work with interface types
56-
declare const _assetsGlobal: Assets;
57-
declare const _npmGlobal: Npm;
58-
declare const _packageGlobal: Package;
59-
declare const _appGlobal: App;
60-
declare const _cordovaGlobal: Cordova;

packages/tools/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"noEmit": true,
1010
"baseUrl": ".",
1111
"paths": {
12-
"meteor/tools": ["./tools.d.ts"],
1312
"meteor/tinytest": ["./tinytest.d.ts"]
1413
}
1514
},

0 commit comments

Comments
 (0)