@@ -1712,190 +1712,6 @@ suite('MDBExtensionController Test Suite', function () {
1712
1712
} ) ;
1713
1713
} ) ;
1714
1714
} ) ;
1715
-
1716
- suite ( 'copilot introduction prompt' , function ( ) {
1717
- suite (
1718
- 'when a user has been shown the startup notification already' ,
1719
- function ( ) {
1720
- beforeEach ( ( ) => {
1721
- sandbox
1722
- . stub (
1723
- mdbTestExtension . testExtensionController ,
1724
- '_startupNotificationShown'
1725
- )
1726
- . get ( function getterFn ( ) {
1727
- return true ;
1728
- } ) ;
1729
- } ) ;
1730
-
1731
- test ( 'they are not shown the copilot introduction prompt' , ( ) => {
1732
- assert ( showInformationMessageStub . notCalled ) ;
1733
- } ) ;
1734
- }
1735
- ) ;
1736
-
1737
- suite (
1738
- "when a user hasn't been shown the copilot introduction prompt yet, and they have connections saved" ,
1739
- ( ) => {
1740
- [
1741
- {
1742
- description : 'clicked the button' ,
1743
- value : { title : 'Chat with @MongoDB' } ,
1744
- } ,
1745
- { description : 'dismissed' , value : undefined } ,
1746
- ] . forEach ( ( reaction ) => {
1747
- suite ( `user ${ reaction . description } ` , ( ) => {
1748
- let connectionsUpdateStub : SinonStub ;
1749
- let executeCommandStub : SinonStub ;
1750
- beforeEach ( async ( ) => {
1751
- sandbox
1752
- . stub (
1753
- mdbTestExtension . testExtensionController ,
1754
- '_startupNotificationShown'
1755
- )
1756
- . set ( function setterFn ( ) { } )
1757
- . get ( function getterFn ( ) {
1758
- return false ;
1759
- } ) ;
1760
- showInformationMessageStub . resolves ( reaction . value ) ;
1761
- executeCommandStub = sandbox . stub (
1762
- vscode . commands ,
1763
- 'executeCommand'
1764
- ) ;
1765
- sandbox . replace (
1766
- mdbTestExtension . testExtensionController . _storageController ,
1767
- 'get' ,
1768
- sandbox . fake . returns ( undefined )
1769
- ) ;
1770
- sandbox . replace (
1771
- mdbTestExtension . testExtensionController . _connectionStorage ,
1772
- 'hasSavedConnections' ,
1773
- sandbox . fake . returns ( true )
1774
- ) ;
1775
- connectionsUpdateStub = sandbox . stub (
1776
- mdbTestExtension . testExtensionController . _storageController ,
1777
- 'update'
1778
- ) ;
1779
- connectionsUpdateStub . resolves ( undefined ) ;
1780
- await mdbTestExtension . testExtensionController . showCopilotIntroductionForEstablishedUsers ( ) ;
1781
- } ) ;
1782
-
1783
- afterEach ( ( ) => {
1784
- sandbox . restore ( ) ;
1785
- } ) ;
1786
-
1787
- test ( 'they are shown the copilot introduction prompt' , ( ) => {
1788
- assert ( showInformationMessageStub . called ) ;
1789
- assert . strictEqual (
1790
- showInformationMessageStub . firstCall . args [ 0 ] ,
1791
- 'Generate queries, interact with documentation, and explore your database schema using the MongoDB Copilot extension. Give it a try!'
1792
- ) ;
1793
- } ) ;
1794
-
1795
- test ( 'the link was open if and only if they click the button' , ( ) => {
1796
- if ( reaction . value === undefined ) {
1797
- assert ( executeCommandStub . notCalled ) ;
1798
- }
1799
- if ( reaction . value ) {
1800
- assert ( executeCommandStub . called ) ;
1801
- assert . strictEqual (
1802
- executeCommandStub . firstCall . args [ 0 ] ,
1803
- 'workbench.action.chat.newChat'
1804
- ) ;
1805
- }
1806
- } ) ;
1807
-
1808
- test ( "it sets that they've been shown the copilot introduction" , ( ) => {
1809
- assert ( connectionsUpdateStub . called ) ;
1810
- assert . strictEqual (
1811
- connectionsUpdateStub . firstCall . args [ 0 ] ,
1812
- StorageVariables . GLOBAL_COPILOT_INTRODUCTION_SHOWN
1813
- ) ;
1814
- assert . strictEqual (
1815
- connectionsUpdateStub . firstCall . args [ 1 ] ,
1816
- true
1817
- ) ;
1818
- } ) ;
1819
- } ) ;
1820
- } ) ;
1821
- }
1822
- ) ;
1823
-
1824
- suite (
1825
- 'when a user has been shown the copilot introduction prompt already' ,
1826
- ( ) => {
1827
- let connectionsUpdateStub : SinonStub ;
1828
- beforeEach ( ( ) => {
1829
- sandbox
1830
- . stub (
1831
- mdbTestExtension . testExtensionController ,
1832
- '_startupNotificationShown'
1833
- )
1834
- . set ( function setterFn ( ) { } )
1835
- . get ( function getterFn ( ) {
1836
- return false ;
1837
- } ) ;
1838
- sandbox . replace (
1839
- mdbTestExtension . testExtensionController . _storageController ,
1840
- 'get' ,
1841
- sandbox . fake . returns ( true ) // copilot introduction has been shown
1842
- ) ;
1843
- sandbox . replace (
1844
- mdbTestExtension . testExtensionController . _connectionStorage ,
1845
- 'hasSavedConnections' ,
1846
- sandbox . fake . returns ( true )
1847
- ) ;
1848
- connectionsUpdateStub = sandbox . stub (
1849
- mdbTestExtension . testExtensionController . _storageController ,
1850
- 'update'
1851
- ) ;
1852
- connectionsUpdateStub . resolves ( undefined ) ;
1853
-
1854
- void mdbTestExtension . testExtensionController . showCopilotIntroductionForEstablishedUsers ( ) ;
1855
- } ) ;
1856
-
1857
- test ( 'they are not shown the copilot introduction prompt' , ( ) => {
1858
- assert ( showInformationMessageStub . notCalled ) ;
1859
- } ) ;
1860
- }
1861
- ) ;
1862
-
1863
- suite ( 'when a has no connections saved' , ( ) => {
1864
- let connectionsUpdateStub : SinonStub ;
1865
- beforeEach ( ( ) => {
1866
- sandbox
1867
- . stub (
1868
- mdbTestExtension . testExtensionController ,
1869
- '_startupNotificationShown'
1870
- )
1871
- . set ( function setterFn ( ) { } )
1872
- . get ( function getterFn ( ) {
1873
- return false ;
1874
- } ) ;
1875
- sandbox . replace (
1876
- mdbTestExtension . testExtensionController . _storageController ,
1877
- 'get' ,
1878
- sandbox . fake . returns ( undefined )
1879
- ) ;
1880
- sandbox . replace (
1881
- mdbTestExtension . testExtensionController . _connectionStorage ,
1882
- 'hasSavedConnections' ,
1883
- sandbox . fake . returns ( false ) // no connections yet - this might be the first install
1884
- ) ;
1885
- connectionsUpdateStub = sandbox . stub (
1886
- mdbTestExtension . testExtensionController . _storageController ,
1887
- 'update'
1888
- ) ;
1889
- connectionsUpdateStub . resolves ( undefined ) ;
1890
-
1891
- void mdbTestExtension . testExtensionController . showCopilotIntroductionForEstablishedUsers ( ) ;
1892
- } ) ;
1893
-
1894
- test ( 'they are not shown the copilot introduction prompt' , ( ) => {
1895
- assert ( showInformationMessageStub . notCalled ) ;
1896
- } ) ;
1897
- } ) ;
1898
- } ) ;
1899
1715
} ) ;
1900
1716
1901
1717
test ( 'mdb.participantViewRawSchemaOutput command opens a json document with the output' , async ( ) => {
0 commit comments