-
Notifications
You must be signed in to change notification settings - Fork 62
Expand file tree
/
Copy pathUserFunction.test.ts
More file actions
44 lines (35 loc) · 1.25 KB
/
UserFunction.test.ts
File metadata and controls
44 lines (35 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/** Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
"use strict";
require("should");
import { load } from "../../../src/utils/UserFunction";
describe("Invoking the load function", async() => {
it("should resolve promise when init hook function is present", async() => {
const handler = "InitPresent.handler"
const appRoot = "test/unit/utils/function";
const handlerFunc = (await load(
appRoot,
handler
)) as Function;
handlerFunc.should.be.Function;
handlerFunc().should.be.true;
});
it("should not fail when init hook function is absent", async() => {
const handler = "InitAbsent.handler"
const appRoot = "test/unit/utils/function";
const handlerFunc = (await load(
appRoot,
handler
)) as Function;
handlerFunc.should.be.Function;
});
it("should catch TypeError exception", async() => {
const handler = "InitThrowsTypeError.handler"
const appRoot = "test/unit/utils/function";
const handlerFunc = (await load(
appRoot,
handler
)) as Function;
handlerFunc.should.be.Function;
handlerFunc().should.be.true;
});
});