Skip to content

Commit

Permalink
Add tests for babel/babel#12227
Browse files Browse the repository at this point in the history
  • Loading branch information
sosukesuzuki committed Nov 6, 2020
1 parent c4d10b5 commit b6a5865
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/typescript/declare/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -110,11 +110,23 @@ declare interface Dictionary<T> {
[index: string]: T
}
declare interface B {
foo([]?): void;
bar({}, []?): any;
baz(a: string, b: number, []?): void;
}
=====================================output=====================================
declare interface Dictionary<T> {
[index: string]: T;
}
declare interface B {
foo([]?): void;
bar({}, []?): any;
baz(a: string, b: number, []?): void;
}
================================================================================
`;
Expand Down
6 changes: 6 additions & 0 deletions tests/typescript/declare/declare_interface.ts
@@ -1,3 +1,9 @@
declare interface Dictionary<T> {
[index: string]: T
}

declare interface B {
foo([]?): void;
bar({}, []?): any;
baz(a: string, b: number, []?): void;
}
45 changes: 45 additions & 0 deletions tests/typescript/interface/__snapshots__/jsfmt.spec.js.snap
Expand Up @@ -844,6 +844,51 @@ export interface ThirdVeryLongAndBoringInterfaceName
================================================================================
`;
exports[`pattern-parameters.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
semi: false
| printWidth
=====================================input======================================
interface B {
foo([]?): void;
bar({}, []?): any;
baz(a: string, b: number, []?): void;
}
=====================================output=====================================
interface B {
foo([]?): void
bar({}, []?): any
baz(a: string, b: number, []?): void
}
================================================================================
`;
exports[`pattern-parameters.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
interface B {
foo([]?): void;
bar({}, []?): any;
baz(a: string, b: number, []?): void;
}
=====================================output=====================================
interface B {
foo([]?): void;
bar({}, []?): any;
baz(a: string, b: number, []?): void;
}
================================================================================
`;
exports[`separator.ts - {"semi":false} format 1`] = `
====================================options=====================================
parsers: ["typescript"]
Expand Down
5 changes: 5 additions & 0 deletions tests/typescript/interface/pattern-parameters.ts
@@ -0,0 +1,5 @@
interface B {
foo([]?): void;
bar({}, []?): any;
baz(a: string, b: number, []?): void;
}
23 changes: 23 additions & 0 deletions tests/typescript/type-alias/__snapshots__/jsfmt.spec.js.snap
@@ -0,0 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`pattern-parameter.ts format 1`] = `
====================================options=====================================
parsers: ["typescript"]
printWidth: 80
| printWidth
=====================================input======================================
type C = {
foo([]?): void;
bar({}, []?): any;
baz(a: string, b: number, []?): void;
};
=====================================output=====================================
type C = {
foo([]?): void;
bar({}, []?): any;
baz(a: string, b: number, []?): void;
};
================================================================================
`;
1 change: 1 addition & 0 deletions tests/typescript/type-alias/jsfmt.spec.js
@@ -0,0 +1 @@
run_spec(__dirname, ["typescript"]);
5 changes: 5 additions & 0 deletions tests/typescript/type-alias/pattern-parameter.ts
@@ -0,0 +1,5 @@
type C = {
foo([]?): void;
bar({}, []?): any;
baz(a: string, b: number, []?): void;
};

0 comments on commit b6a5865

Please sign in to comment.