Skip to content

Commit 6ea00a4

Browse files
committed
chore: support test for async function file loading
1 parent 8bf0ba5 commit 6ea00a4

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"use strict";
2+
exports.__esModule = true;
3+
exports["default"] = {
4+
fn() {
5+
return new Promise((res) => {
6+
setTimeout(() => {
7+
res({
8+
clients: 'Test Config'
9+
});
10+
}, 500);
11+
});
12+
},
13+
};

‎test/loader/load_file.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,10 @@ describe('test/loader/load_file.test.ts', () => {
3636
}
3737
assert.equal(result, '---\nmap:\n a: 1\n b: 2');
3838
});
39+
40+
it('should load file which returns async function', async () => {
41+
app = createApp('load_file');
42+
const result = (await app.loader.loadFile(getFilepath('load_file/es-module-default-async.yml'))).toString();
43+
assert.deepEqual(result, { clients: 'Test Config' });
44+
});
3945
});

0 commit comments

Comments
 (0)