forked from woutervh-/typescript-is
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathissue-104.ts
25 lines (24 loc) · 1.18 KB
/
issue-104.ts
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
import * as assert from 'assert';
import {AsyncMethods} from '../test-fixtures/issue-104';
describe('@ValidateClass(), @AssertType()', () => {
it('should return rejected promise for async methods', () => {
const instance = new AsyncMethods()
assert.rejects(instance.asyncMethod({invalid: 123} as any))
})
it('should return rejected promise for async methods with not explicit return type', () => {
const instance = new AsyncMethods()
assert.rejects(instance.asyncMethodNoExplicitReturn({invalid: 123} as any))
})
it('should return rejected promise for methods returning promise', () => {
const instance = new AsyncMethods()
assert.rejects(instance.promiseReturnMethod({invalid: 123} as any))
})
it('should throw synchronously if { async: false } option is set', () => {
const instance = new AsyncMethods()
assert.throws(() => instance.asyncOverride({invalid: 123} as any))
})
it('should throw synchronously method may return something other than promise', () => {
const instance = new AsyncMethods()
assert.throws(() => instance.promiseOrOtherReturnMethod({invalid: 123} as any))
})
})