-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupper.test.js
More file actions
26 lines (22 loc) · 870 Bytes
/
upper.test.js
File metadata and controls
26 lines (22 loc) · 870 Bytes
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
const Upper = require('../src/upper');
describe('Upper', () => {
it('should convert all characters to uppercase', () => {
const str = 'hello world';
const upperInstance = new Upper(str);
expect(upperInstance.execute()).toBe('HELLO WORLD');
});
it('should handle strings with special characters', () => {
const str = 'ThIs_is_a_TeSt';
const upperInstance = new Upper(str);
expect(upperInstance.execute()).toBe('THIS_IS_A_TEST');
});
it('should handle strings with numbers', () => {
const str = '123 test 456';
const upperInstance = new Upper(str);
expect(upperInstance.execute()).toBe('123 TEST 456');
});
it('should handle non-string inputs', () => {
const str = 123;
expect(() => new Upper(str)).toThrowError('Input must be a string.');
});
});