@@ -175,14 +175,12 @@ suite('MDBExtensionController Test Suite', function () {
175
175
let fakeActiveConnectionId : SinonSpy ;
176
176
let showErrorMessageStub : SinonStub ;
177
177
let fakeCreatePlaygroundFileWithContent : SinonSpy ;
178
- let openExternalStub : SinonStub ;
179
178
180
179
beforeEach ( ( ) => {
181
180
showInformationMessageStub = sandbox . stub (
182
181
vscode . window ,
183
182
'showInformationMessage'
184
183
) ;
185
- openExternalStub = sandbox . stub ( vscode . env , 'openExternal' ) ;
186
184
openTextDocumentStub = sandbox . stub ( vscode . workspace , 'openTextDocument' ) ;
187
185
fakeActiveConnectionId = sandbox . fake . returns ( 'tasty_sandwich' ) ;
188
186
sandbox . replace (
@@ -1715,186 +1713,6 @@ suite('MDBExtensionController Test Suite', function () {
1715
1713
} ) ;
1716
1714
} ) ;
1717
1715
1718
- suite ( 'survey prompt' , function ( ) {
1719
- suite (
1720
- 'when a user has been shown the startup notification already' ,
1721
- function ( ) {
1722
- beforeEach ( ( ) => {
1723
- sandbox
1724
- . stub (
1725
- mdbTestExtension . testExtensionController ,
1726
- '_startupNotificationShown'
1727
- )
1728
- . get ( function getterFn ( ) {
1729
- return true ;
1730
- } ) ;
1731
- } ) ;
1732
-
1733
- test ( 'they are not shown the survey prompt' , ( ) => {
1734
- assert ( showInformationMessageStub . notCalled ) ;
1735
- } ) ;
1736
- }
1737
- ) ;
1738
-
1739
- suite (
1740
- "when a user hasn't been shown the survey prompt yet, and they have connections saved" ,
1741
- ( ) => {
1742
- [
1743
- {
1744
- description : 'clicked the button' ,
1745
- value : { title : 'Share your thoughts' } ,
1746
- } ,
1747
- { description : 'dismissed' , value : undefined } ,
1748
- ] . forEach ( ( reaction ) => {
1749
- suite ( `user ${ reaction . description } ` , ( ) => {
1750
- let connectionsUpdateStub : SinonStub ;
1751
- let uriParseStub : SinonStub ;
1752
- beforeEach ( async ( ) => {
1753
- sandbox
1754
- . stub (
1755
- mdbTestExtension . testExtensionController ,
1756
- '_startupNotificationShown'
1757
- )
1758
- . set ( function setterFn ( ) { } )
1759
- . get ( function getterFn ( ) {
1760
- return false ;
1761
- } ) ;
1762
- showInformationMessageStub . resolves ( reaction . value ) ;
1763
- openExternalStub . resolves ( undefined ) ;
1764
- sandbox . replace (
1765
- mdbTestExtension . testExtensionController . _storageController ,
1766
- 'get' ,
1767
- sandbox . fake . returns ( undefined )
1768
- ) ;
1769
- sandbox . replace (
1770
- mdbTestExtension . testExtensionController . _connectionStorage ,
1771
- 'hasSavedConnections' ,
1772
- sandbox . fake . returns ( true )
1773
- ) ;
1774
- connectionsUpdateStub = sandbox . stub (
1775
- mdbTestExtension . testExtensionController . _storageController ,
1776
- 'update'
1777
- ) ;
1778
- uriParseStub = sandbox . stub ( vscode . Uri , 'parse' ) ;
1779
- connectionsUpdateStub . resolves ( undefined ) ;
1780
- await mdbTestExtension . testExtensionController . showSurveyForEstablishedUsers ( ) ;
1781
- } ) ;
1782
-
1783
- afterEach ( ( ) => {
1784
- sandbox . restore ( ) ;
1785
- } ) ;
1786
-
1787
- test ( 'they are shown the survey prompt' , ( ) => {
1788
- assert ( showInformationMessageStub . called ) ;
1789
- assert . strictEqual (
1790
- showInformationMessageStub . firstCall . args [ 0 ] ,
1791
- 'How can we make the MongoDB extension better for you?'
1792
- ) ;
1793
- } ) ;
1794
-
1795
- test ( 'the link was open if and only if they click the button' , ( ) => {
1796
- if ( reaction . value === undefined ) {
1797
- assert ( openExternalStub . notCalled ) ;
1798
- }
1799
- if ( reaction . value ) {
1800
- assert ( openExternalStub . called ) ;
1801
- assert ( uriParseStub . called ) ;
1802
- assert . strictEqual (
1803
- uriParseStub . firstCall . args [ 0 ] ,
1804
- 'https://forms.gle/9viN9wcbsC3zvHyg7'
1805
- ) ;
1806
- }
1807
- } ) ;
1808
-
1809
- test ( "it sets that they've been shown the survey" , ( ) => {
1810
- assert ( connectionsUpdateStub . called ) ;
1811
- assert . strictEqual (
1812
- connectionsUpdateStub . firstCall . args [ 0 ] ,
1813
- StorageVariables . GLOBAL_SURVEY_SHOWN
1814
- ) ;
1815
- assert . strictEqual (
1816
- connectionsUpdateStub . firstCall . args [ 1 ] ,
1817
- '9viN9wcbsC3zvHyg7'
1818
- ) ;
1819
- } ) ;
1820
- } ) ;
1821
- } ) ;
1822
- }
1823
- ) ;
1824
-
1825
- suite ( 'when a user has been shown the survey prompt already' , ( ) => {
1826
- let connectionsUpdateStub : SinonStub ;
1827
- beforeEach ( ( ) => {
1828
- sandbox
1829
- . stub (
1830
- mdbTestExtension . testExtensionController ,
1831
- '_startupNotificationShown'
1832
- )
1833
- . set ( function setterFn ( ) { } )
1834
- . get ( function getterFn ( ) {
1835
- return false ;
1836
- } ) ;
1837
- sandbox . replace (
1838
- mdbTestExtension . testExtensionController . _storageController ,
1839
- 'get' ,
1840
- sandbox . fake . returns ( '9viN9wcbsC3zvHyg7' ) // survey has been shown
1841
- ) ;
1842
- sandbox . replace (
1843
- mdbTestExtension . testExtensionController . _connectionStorage ,
1844
- 'hasSavedConnections' ,
1845
- sandbox . fake . returns ( true )
1846
- ) ;
1847
- connectionsUpdateStub = sandbox . stub (
1848
- mdbTestExtension . testExtensionController . _storageController ,
1849
- 'update'
1850
- ) ;
1851
- connectionsUpdateStub . resolves ( undefined ) ;
1852
-
1853
- void mdbTestExtension . testExtensionController . showSurveyForEstablishedUsers ( ) ;
1854
- } ) ;
1855
-
1856
- test ( 'they are not shown the survey prompt' , ( ) => {
1857
- assert ( showInformationMessageStub . notCalled ) ;
1858
- } ) ;
1859
- } ) ;
1860
-
1861
- suite ( 'when a has no connections saved' , ( ) => {
1862
- let connectionsUpdateStub : SinonStub ;
1863
- beforeEach ( ( ) => {
1864
- sandbox
1865
- . stub (
1866
- mdbTestExtension . testExtensionController ,
1867
- '_startupNotificationShown'
1868
- )
1869
- . set ( function setterFn ( ) { } )
1870
- . get ( function getterFn ( ) {
1871
- return false ;
1872
- } ) ;
1873
- sandbox . replace (
1874
- mdbTestExtension . testExtensionController . _storageController ,
1875
- 'get' ,
1876
- sandbox . fake . returns ( undefined )
1877
- ) ;
1878
- sandbox . replace (
1879
- mdbTestExtension . testExtensionController . _connectionStorage ,
1880
- 'hasSavedConnections' ,
1881
- sandbox . fake . returns ( false ) // no connections yet - this might be the first install
1882
- ) ;
1883
- connectionsUpdateStub = sandbox . stub (
1884
- mdbTestExtension . testExtensionController . _storageController ,
1885
- 'update'
1886
- ) ;
1887
- connectionsUpdateStub . resolves ( undefined ) ;
1888
-
1889
- void mdbTestExtension . testExtensionController . showSurveyForEstablishedUsers ( ) ;
1890
- } ) ;
1891
-
1892
- test ( 'they are not shown the survey prompt' , ( ) => {
1893
- assert ( showInformationMessageStub . notCalled ) ;
1894
- } ) ;
1895
- } ) ;
1896
- } ) ;
1897
-
1898
1716
suite ( 'copilot introduction prompt' , function ( ) {
1899
1717
suite (
1900
1718
'when a user has been shown the startup notification already' ,
0 commit comments