@@ -2,19 +2,19 @@ import assert from "node:assert/strict";
2
2
import { describe , it } from "node:test" ;
3
3
import { z } from "zod" ;
4
4
import { assertType } from "../../shared/src/ts.utils.ts" ;
5
- import { dir } from "./dir.lib.ts" ;
6
- import { file } from "./file.lib.ts" ;
5
+ import { fsDir } from "./dir.lib.ts" ;
6
+ import { fsFile } from "./file.lib.ts" ;
7
7
8
8
const _typeTests = async ( ) => {
9
9
const schema = z . object ( {
10
10
id : z . string ( ) ,
11
11
name : z . string ( ) ,
12
12
} ) ;
13
- const schemaFile = file ( "" ) . schema ( schema ) ;
13
+ const schemaFile = fsFile ( "" ) . schema ( schema ) ;
14
14
type Output = z . infer < typeof schema > ;
15
15
16
16
assertType < Output > ( await schemaFile . read . json ( ) ) ;
17
- assertType < [ 1 , 2 ] > ( await file ( "" ) . read . json < [ 1 , 2 ] > ( ) ) ;
17
+ assertType < [ 1 , 2 ] > ( await fsFile ( "" ) . read . json < [ 1 , 2 ] > ( ) ) ;
18
18
assertType < Output > ( schemaFile . read . jsonSync ( ) ) ;
19
19
assertType < Output > ( await schemaFile . read . yaml ( ) ) ;
20
20
assertType < Output > ( schemaFile . read . yamlSync ( ) ) ;
@@ -30,49 +30,49 @@ const _typeTests = async () => {
30
30
describe ( "File" , ( ) => {
31
31
describe ( "file" , ( ) => {
32
32
it ( "creates a file from a path" , ( ) => {
33
- const testFile = file ( "/super/path/test.txt" ) ;
33
+ const testFile = fsFile ( "/super/path/test.txt" ) ;
34
34
assert . equal ( testFile . path , "/super/path/test.txt" ) ;
35
35
} ) ;
36
36
} ) ;
37
37
describe ( "toFile" , ( ) => {
38
38
it ( "creates a file from a relative path" , ( ) => {
39
- const testFile = file ( "/super/path/test.txt" ) ;
39
+ const testFile = fsFile ( "/super/path/test.txt" ) ;
40
40
assert . equal ( testFile . toFile ( "../other.txt" ) . path , "/super/other.txt" ) ;
41
41
} ) ;
42
42
} ) ;
43
43
describe ( "toDir" , ( ) => {
44
44
it ( "creates a dir from a relative path" , ( ) => {
45
- const testFile = file ( "/super/path/test.txt" ) ;
45
+ const testFile = fsFile ( "/super/path/test.txt" ) ;
46
46
assert . equal ( testFile . toDir ( "../other" ) . path , "/super/other" ) ;
47
47
} ) ;
48
48
} ) ;
49
49
describe ( "relativePathTo" , ( ) => {
50
50
it ( "returns the relative path to another file" , ( ) => {
51
- const testFile = file ( "/super/path/test.txt" ) ;
51
+ const testFile = fsFile ( "/super/path/test.txt" ) ;
52
52
assert . equal (
53
- testFile . relativePathTo ( file ( "/super/other/other.txt" ) ) ,
53
+ testFile . relativePathTo ( fsFile ( "/super/other/other.txt" ) ) ,
54
54
"../other/other.txt" ,
55
55
) ;
56
56
} ) ;
57
57
it ( "returns the relative path to another folder" , ( ) => {
58
58
assert . equal (
59
- file ( "/super/path/test.txt" ) . relativePathTo ( dir ( "/super/other" ) ) ,
59
+ fsFile ( "/super/path/test.txt" ) . relativePathTo ( fsDir ( "/super/other" ) ) ,
60
60
"../other" ,
61
61
) ;
62
62
} ) ;
63
63
} ) ;
64
64
describe ( "relativePathFrom" , ( ) => {
65
65
it ( "returns the relative path from another file" , ( ) => {
66
- const testFile = file ( "/super/path/test.txt" ) ;
66
+ const testFile = fsFile ( "/super/path/test.txt" ) ;
67
67
assert . equal (
68
- testFile . relativePathFrom ( file ( "/super/other/other.txt" ) ) ,
68
+ testFile . relativePathFrom ( fsFile ( "/super/other/other.txt" ) ) ,
69
69
"../path/test.txt" ,
70
70
) ;
71
71
} ) ;
72
72
it ( "returns the relative path from another folder" , ( ) => {
73
- const testFile = file ( "/super/path/test.txt" ) ;
73
+ const testFile = fsFile ( "/super/path/test.txt" ) ;
74
74
assert . equal (
75
- testFile . relativePathFrom ( dir ( "/super/other" ) ) ,
75
+ testFile . relativePathFrom ( fsDir ( "/super/other" ) ) ,
76
76
"../path/test.txt" ,
77
77
) ;
78
78
} ) ;
0 commit comments