From 31e209a0e8363a6896461a8654e51ee8675d1c34 Mon Sep 17 00:00:00 2001 From: Jinho Bang Date: Sun, 8 Oct 2017 15:26:03 +0900 Subject: [PATCH] Write more tests in interface_static_method.test.ts (#118) Need more tests. ISSUE=#99,#100 --- test/interface_static_method.test.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/interface_static_method.test.ts b/test/interface_static_method.test.ts index 85965c5..674f41b 100644 --- a/test/interface_static_method.test.ts +++ b/test/interface_static_method.test.ts @@ -27,3 +27,29 @@ test('Basic of static method', async () => { expect(bacardi.TestInterface.getLastCallInfo()) .toBe('static boolean staticMethod2(long, string)'); }); + +test('Calling undefined static method should throw error', async () => { + expect(() => { + bacardi.TestInterface.undefinedStaticMethod1(); + }).toThrowError(TypeError); + + expect(() => { + bacardi.TestInterface.undefinedStaticMethod2(10, 'test'); + }).toThrowError(TypeError); +}); + +test('Static method with invalid arguments should throw error', async () => { + expect(() => { + bacardi.TestInterface.staticMethod2(10, 20); + }).toThrowError(); +}); + +test('Static method with invalid signature should throw error', async () => { + expect(() => { + bacardi.TestInterface.staticMethod1(10); + }).toThrowError(); + + expect(() => { + bacardi.TestInterface.staticMethod2(); + }).toThrowError(); +});