|
1 | 1 | import {expect, test} from '@oclif/test'
|
| 2 | +import * as moment from 'moment-timezone' //has both momentjs and timezone support |
2 | 3 |
|
3 | 4 | describe('datetime', () => {
|
4 | 5 | test
|
5 | 6 | .stdout()
|
6 |
| - .command(['datetime', '01-Jul-2019']) |
| 7 | + .command(['datetime', '2019-07-01 00:00:00']) |
7 | 8 | .it('If locale is not given, default - en', ctx => {
|
8 |
| - expect(ctx.stdout).to.contain('1st July 2019, 12:0:0 AM, +05:30 UTC') |
| 9 | + expect(ctx.stdout).to.contain(`1st July 2019, 12:0:0 AM, ${moment('01-Jul-2019').format('Z')} UTC`) |
9 | 10 | })
|
10 | 11 |
|
11 | 12 | test
|
12 | 13 | .stdout()
|
13 |
| - .command(['datetime', '01-Jul-2019', '-l', 'fr']) |
| 14 | + .command(['datetime', '2019-07-01 00:00:00', '-l', 'fr']) |
14 | 15 | .it('If locale is given for french', ctx => {
|
15 |
| - expect(ctx.stdout).to.contain('1er juillet 2019, 12:0:0 AM, +05:30 UTC') |
| 16 | + expect(ctx.stdout).to.contain(`1er juillet 2019, 12:0:0 AM, ${moment('01-Jul-2019').format('Z')} UTC`) |
16 | 17 | })
|
17 | 18 |
|
18 | 19 | test
|
19 | 20 | .stdout()
|
20 |
| - .command(['datetime', '01-Jul-2019', '-l', 'hi']) |
| 21 | + .command(['datetime', '2019-07-01 00:00:00', '-l', 'hi']) |
21 | 22 | .it('If locale is given for hindi', ctx => {
|
22 | 23 | expect(ctx.stdout).to.contain('१ जुलाई २०१९, १२:०:० रात, +०५:३० UTC')
|
23 | 24 | })
|
|
0 commit comments