@@ -44,6 +44,7 @@ suite(`${reportIssue.name}`, () => {
4444 let eventBus : TestEventBus ;
4545 let getDotnetInfo = FakeGetDotnetInfo ;
4646 let options : Options ;
47+ let issueBody : string ;
4748
4849 setup ( ( ) => {
4950 vscode = getFakeVsCode ( ) ;
@@ -55,6 +56,12 @@ suite(`${reportIssue.name}`, () => {
5556 id : ""
5657 } ;
5758 } ;
59+
60+ vscode . env . clipboard . writeText = ( body :string ) => {
61+ issueBody = body ;
62+ return undefined ;
63+ } ;
64+
5865 vscode . version = vscodeVersion ;
5966 vscode . extensions . all = [ extension1 , extension2 ] ;
6067 eventStream = new EventStream ( ) ;
@@ -72,60 +79,56 @@ suite(`${reportIssue.name}`, () => {
7279 test ( `${ OpenURL . name } event is created with the omnisharp-vscode github repo issues url` , async ( ) => {
7380 await reportIssue ( vscode , eventStream , getDotnetInfo , false , options , fakeMonoResolver ) ;
7481 let url = ( < OpenURL > eventBus . getEvents ( ) [ 0 ] ) . url ;
75- expect ( url ) . to . include ( "https://github.com/OmniSharp/omnisharp-vscode/issues/new" ) ;
82+ expect ( url ) . to . include ( "https://github.com/OmniSharp/omnisharp-vscode/issues/new?body=Please paste the output from your clipboard " ) ;
7683 } ) ;
7784
78- test ( "The url contains the vscode version" , async ( ) => {
79- await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
80- let url = ( < OpenURL > eventBus . getEvents ( ) [ 0 ] ) . url ;
81- expect ( url ) . to . include ( encodeURIComponent ( encodeURIComponent ( `**VSCode version**: ${ vscodeVersion } ` ) ) ) ;
82- } ) ;
85+ suite ( "The body is passed to the vscode clipboard and" , ( ) => {
86+ test ( "it contains the vscode version" , async ( ) => {
87+ await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
88+ expect ( issueBody ) . to . include ( `**VSCode version**: ${ vscodeVersion } ` ) ;
89+ } ) ;
8390
84- test ( "The body contains the csharp extension version" , async ( ) => {
85- await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
86- let url = ( < OpenURL > eventBus . getEvents ( ) [ 0 ] ) . url ;
87- expect ( url ) . to . include ( encodeURIComponent ( encodeURIComponent ( `**C# Extension**: ${ csharpExtVersion } ` ) ) ) ;
88- } ) ;
91+ test ( "it contains the csharp extension version" , async ( ) => {
92+ await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
93+ expect ( issueBody ) . to . include ( `**C# Extension**: ${ csharpExtVersion } ` ) ;
94+ } ) ;
8995
90- test ( "dotnet info is obtained and put into the url" , async ( ) => {
91- await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
92- let url = ( < OpenURL > eventBus . getEvents ( ) [ 0 ] ) . url ;
93- expect ( url ) . to . contain ( fakeDotnetInfo ) ;
94- } ) ;
96+ test ( "it contains dotnet info" , async ( ) => {
97+ await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
98+ expect ( issueBody ) . to . contain ( fakeDotnetInfo ) ;
99+ } ) ;
95100
96- test ( "mono information is obtained when it is a valid mono platform" , async ( ) => {
97- await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
98- expect ( fakeMonoResolver . getGlobalMonoCalled ) . to . be . equal ( true ) ;
99- } ) ;
101+ test ( "mono information is obtained when it is a valid mono platform" , async ( ) => {
102+ await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
103+ expect ( fakeMonoResolver . getGlobalMonoCalled ) . to . be . equal ( true ) ;
104+ } ) ;
100105
101- test ( "mono version is put in the body when shouldUseGlobalMono returns a monoInfo" , async ( ) => {
102- await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
103- expect ( fakeMonoResolver . getGlobalMonoCalled ) . to . be . equal ( true ) ;
104- let url = ( < OpenURL > eventBus . getEvents ( ) [ 0 ] ) . url ;
105- expect ( url ) . to . contain ( fakeMonoInfo . version ) ;
106- } ) ;
106+ test ( "mono version is put in the body when shouldUseGlobalMono returns a monoInfo" , async ( ) => {
107+ await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
108+ expect ( fakeMonoResolver . getGlobalMonoCalled ) . to . be . equal ( true ) ;
109+ expect ( issueBody ) . to . contain ( fakeMonoInfo . version ) ;
110+ } ) ;
107111
108- test ( "built-in mono usage message is put in the body when shouldUseGlobalMono returns a null" , async ( ) => {
109- fakeMonoResolver = new FakeMonoResolver ( false ) ;
110- await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
111- expect ( fakeMonoResolver . getGlobalMonoCalled ) . to . be . equal ( true ) ;
112- let url = ( < OpenURL > eventBus . getEvents ( ) [ 0 ] ) . url ;
113- expect ( url ) . to . contain ( encodeURIComponent ( encodeURIComponent ( `OmniSharp using built-in mono` ) ) ) ;
114- } ) ;
112+ test ( "built-in mono usage message is put in the body when shouldUseGlobalMono returns a null" , async ( ) => {
113+ fakeMonoResolver = new FakeMonoResolver ( false ) ;
114+ await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
115+ expect ( fakeMonoResolver . getGlobalMonoCalled ) . to . be . equal ( true ) ;
116+ expect ( issueBody ) . to . contain ( `OmniSharp using built-in mono` ) ;
117+ } ) ;
115118
116- test ( "mono information is not obtained when it is not a valid mono platform" , async ( ) => {
117- await reportIssue ( vscode , eventStream , getDotnetInfo , false , options , fakeMonoResolver ) ;
118- expect ( fakeMonoResolver . getGlobalMonoCalled ) . to . be . equal ( false ) ;
119- } ) ;
119+ test ( "mono information is not obtained when it is not a valid mono platform" , async ( ) => {
120+ await reportIssue ( vscode , eventStream , getDotnetInfo , false , options , fakeMonoResolver ) ;
121+ expect ( fakeMonoResolver . getGlobalMonoCalled ) . to . be . equal ( false ) ;
122+ } ) ;
120123
121- test ( "The url contains the name, publisher and version for all the extensions that are not builtin" , async ( ) => {
122- await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
123- let url = ( < OpenURL > eventBus . getEvents ( ) [ 0 ] ) . url ;
124- expect ( url ) . to . contain ( extension2 . packageJSON . name ) ;
125- expect ( url ) . to . contain ( extension2 . packageJSON . publisher ) ;
126- expect ( url ) . to . contain ( extension2 . packageJSON . version ) ;
127- expect ( url ) . to . not . contain ( extension1 . packageJSON . name ) ;
128- expect ( url ) . to . not . contain ( extension1 . packageJSON . publisher ) ;
129- expect ( url ) . to . not . contain ( extension1 . packageJSON . version ) ;
124+ test ( "The url contains the name, publisher and version for all the extensions that are not builtin" , async ( ) => {
125+ await reportIssue ( vscode , eventStream , getDotnetInfo , isValidForMono , options , fakeMonoResolver ) ;
126+ expect ( issueBody ) . to . contain ( extension2 . packageJSON . name ) ;
127+ expect ( issueBody ) . to . contain ( extension2 . packageJSON . publisher ) ;
128+ expect ( issueBody ) . to . contain ( extension2 . packageJSON . version ) ;
129+ expect ( issueBody ) . to . not . contain ( extension1 . packageJSON . name ) ;
130+ expect ( issueBody ) . to . not . contain ( extension1 . packageJSON . publisher ) ;
131+ expect ( issueBody ) . to . not . contain ( extension1 . packageJSON . version ) ;
132+ } ) ;
130133 } ) ;
131134} ) ;
0 commit comments