Skip to content

Commit 0caed21

Browse files
committed
Added tests for the 'server.listResources(...)' method
1 parent 18f0e3a commit 0caed21

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { Test } from '../Type'
2+
import { v2 } from '../../../../lib/index.js'
3+
import { starter } from './.createDir'
4+
5+
export default ((info, isValid) =>
6+
{
7+
const server = info.init(1);
8+
9+
starter(server, info, isValid, (r, subFiles) => {
10+
let error = false;
11+
12+
server.listResources('/', (paths) => {
13+
for(const path of paths)
14+
{
15+
if(path !== '/' && path !== '/folder' && !subFiles.some((p) => '/folder/' + p == path))
16+
{
17+
error = true;
18+
return isValid(false, 'The result of "server.listResources(...)" is invalid.');
19+
}
20+
}
21+
22+
isValid(true);
23+
})
24+
})
25+
26+
}) as Test;

0 commit comments

Comments
 (0)