forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circusItTodoTestError.test.ts
40 lines (34 loc) · 1.18 KB
/
circusItTodoTestError.test.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {Global} from '@jest/types';
let circusIt: Global.It;
// using jest-jasmine2's 'it' to test jest-circus's 'it'. Had to differentiate
// the two with this alias.
const aliasCircusIt = () => {
const {it} = require('../globals');
circusIt = it;
};
aliasCircusIt();
describe('test/it.todo error throwing', () => {
it('todo throws error when given no arguments', () => {
expect(() => {
// @ts-ignore: Testing runtime errors here
circusIt.todo();
}).toThrowError('Todo must be called with only a description.');
});
it('todo throws error when given more than one argument', () => {
expect(() => {
circusIt.todo('test1', () => {});
}).toThrowError('Todo must be called with only a description.');
});
it('todo throws error when given none string description', () => {
expect(() => {
// @ts-ignore: Testing runtime errors here
circusIt.todo(() => {});
}).toThrowError('Todo must be called with only a description.');
});
});