Skip to content

Commit

Permalink
test(prompt): fix windows test's
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed May 29, 2020
1 parent 8b0ee43 commit da1147b
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/prompt/test/checkbox_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Deno.test( 'prompt checkbox: invalid value', async () => {
message: 'message',
options: [ { value: 'value1' }, { value: 'value2' }, 'value3' ]
} );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

Deno.test( 'prompt checkbox: null value', async () => {
Expand All @@ -41,5 +41,5 @@ Deno.test( 'prompt checkbox: null value', async () => {
message: 'message',
options: [ { value: 'value1' }, { value: 'value2' }, 'value3' ]
} );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );
6 changes: 3 additions & 3 deletions packages/prompt/test/confirm_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ Deno.test( 'prompt confirm: empty value', async () => {
await assertThrowsAsync( async () => {
Confirm.inject( '' );
await Confirm.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

Deno.test( 'prompt confirm: invalid value', async () => {
console.log();
await assertThrowsAsync( async () => {
Confirm.inject( 'noo' );
await Confirm.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

Deno.test( 'prompt confirm: null value', async () => {
console.log();
await assertThrowsAsync( async () => {
Confirm.inject( null as any );
await Confirm.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );
6 changes: 3 additions & 3 deletions packages/prompt/test/input_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Deno.test( 'prompt input: empty value', async () => {
await assertThrowsAsync( async () => {
Input.inject( '' );
await Input.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

Deno.test( 'prompt input: invalid value', async () => {
Expand All @@ -35,13 +35,13 @@ Deno.test( 'prompt input: invalid value', async () => {
message: 'message',
validate: value => value.length < 10
} );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

Deno.test( 'prompt input: null value', async () => {
console.log();
await assertThrowsAsync( async () => {
Input.inject( null as any );
await Input.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );
4 changes: 2 additions & 2 deletions packages/prompt/test/list_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Deno.test( 'prompt list: empty value', async () => {
await assertThrowsAsync( async () => {
List.inject( '' );
await List.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

// @TODO: add maxLength option to list pormpt
Expand All @@ -53,5 +53,5 @@ Deno.test('prompt list: null value', async () => {
await assertThrowsAsync( async () => {
List.inject( null as any );
await List.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );
6 changes: 3 additions & 3 deletions packages/prompt/test/number_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ Deno.test( 'prompt number: empty value', async () => {
await assertThrowsAsync( async () => {
Number.inject( '' );
await Number.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

Deno.test( 'prompt number: invalid value', async () => {
await assertThrowsAsync( async () => {
Number.inject( 'abc' );
await Number.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

Deno.test( 'prompt number: null value', async () => {
await assertThrowsAsync( async () => {
Number.inject( null as any );
await Number.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );
6 changes: 3 additions & 3 deletions packages/prompt/test/select_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Deno.test( 'prompt select: empty value', async () => {
message: 'message',
options: [ { value: 'value1' }, { value: 'value2' }, 'value3' ]
} );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

Deno.test( 'prompt select: invalid value', async () => {
Expand All @@ -29,7 +29,7 @@ Deno.test( 'prompt select: invalid value', async () => {
message: 'message',
options: [ { value: 'value1' }, { value: 'value2' }, 'value3' ]
} );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

Deno.test( 'prompt select: null value', async () => {
Expand All @@ -39,5 +39,5 @@ Deno.test( 'prompt select: null value', async () => {
message: 'message',
options: [ { value: 'value1' }, { value: 'value2' }, 'value3' ]
} );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );
6 changes: 3 additions & 3 deletions packages/prompt/test/toggle_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ Deno.test( 'prompt toggle: empty value', async () => {
await assertThrowsAsync( async () => {
Toggle.inject( '' );
await Toggle.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

Deno.test( 'prompt toggle: invalid value', async () => {
console.log();
await assertThrowsAsync( async () => {
Toggle.inject( 'aaa' );
await Toggle.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

Deno.test( 'prompt toggle: null value', async () => {
console.log();
await assertThrowsAsync( async () => {
Toggle.inject( null as any );
await Toggle.prompt( 'message' );
}, Error, red( `${ bold( ' ✘ ' ) }Invalid answer.` ) );
}, Error, red( `${ Deno.build.os === 'windows' ? bold( ' × ' ) : bold( ' ✘ ' ) }Invalid answer.` ) );
} );

0 comments on commit da1147b

Please sign in to comment.