@@ -89,7 +89,9 @@ const SOURCEGRAPH = createMockSourcegraphAPI()
8989
9090describe ( 'getDecorationsFromHunk()' , ( ) => {
9191 it ( 'creates a TextDocumentDecoration from a Hunk' , ( ) => {
92- expect ( getDecorationFromHunk ( FIXTURE_HUNK_1 , NOW , 0 , SOURCEGRAPH as any ) ) . toEqual ( {
92+ expect (
93+ getDecorationFromHunk ( FIXTURE_HUNK_1 , NOW , 0 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any )
94+ ) . toEqual ( {
9395 after : {
9496 contentText : 'a, 3 months ago: • c' ,
9597 dark : {
@@ -119,6 +121,7 @@ describe('getDecorationsFromHunk()', () => {
119121 } ,
120122 NOW ,
121123 0 ,
124+ { 'git.blame.showPreciseDate' : false } ,
122125 SOURCEGRAPH as any
123126 )
124127 expect ( decoration . after && decoration . after . contentText ) . toEqual (
@@ -141,6 +144,7 @@ describe('getDecorationsFromHunk()', () => {
141144 } ,
142145 NOW ,
143146 0 ,
147+ { 'git.blame.showPreciseDate' : false } ,
144148 SOURCEGRAPH as any
145149 )
146150 expect ( decoration . after && decoration . after . contentText ) . toEqual (
@@ -155,9 +159,12 @@ describe('getBlameDecorationsForSelections()', () => {
155159 [ FIXTURE_HUNK_1 , FIXTURE_HUNK_2 , FIXTURE_HUNK_3 , FIXTURE_HUNK_4 ] ,
156160 [ new SOURCEGRAPH . Selection ( new SOURCEGRAPH . Position ( 1 , 0 ) , new SOURCEGRAPH . Position ( 1 , 0 ) ) as any ] ,
157161 NOW ,
162+ { 'git.blame.showPreciseDate' : false } ,
158163 SOURCEGRAPH as any
159164 )
160- expect ( decorations ) . toEqual ( [ getDecorationFromHunk ( FIXTURE_HUNK_2 , NOW , 1 , SOURCEGRAPH as any ) ] )
165+ expect ( decorations ) . toEqual ( [
166+ getDecorationFromHunk ( FIXTURE_HUNK_2 , NOW , 1 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
167+ ] )
161168 } )
162169
163170 it ( 'handles multiple selections' , ( ) => {
@@ -169,12 +176,13 @@ describe('getBlameDecorationsForSelections()', () => {
169176 new SOURCEGRAPH . Selection ( new SOURCEGRAPH . Position ( 6 , 0 ) , new SOURCEGRAPH . Position ( 10 , 0 ) ) as any ,
170177 ] ,
171178 NOW ,
179+ { 'git.blame.showPreciseDate' : false } ,
172180 SOURCEGRAPH as any
173181 )
174182 expect ( decorations ) . toEqual ( [
175- getDecorationFromHunk ( FIXTURE_HUNK_2 , NOW , 1 , SOURCEGRAPH as any ) ,
176- getDecorationFromHunk ( FIXTURE_HUNK_3 , NOW , 2 , SOURCEGRAPH as any ) ,
177- getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , SOURCEGRAPH as any ) ,
183+ getDecorationFromHunk ( FIXTURE_HUNK_2 , NOW , 1 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
184+ getDecorationFromHunk ( FIXTURE_HUNK_3 , NOW , 2 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
185+ getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
178186 ] )
179187 } )
180188
@@ -183,13 +191,14 @@ describe('getBlameDecorationsForSelections()', () => {
183191 [ FIXTURE_HUNK_1 , FIXTURE_HUNK_2 , FIXTURE_HUNK_3 , FIXTURE_HUNK_4 ] ,
184192 [ new SOURCEGRAPH . Selection ( new SOURCEGRAPH . Position ( 0 , 0 ) , new SOURCEGRAPH . Position ( 5 , 0 ) ) as any ] ,
185193 NOW ,
194+ { 'git.blame.showPreciseDate' : false } ,
186195 SOURCEGRAPH as any
187196 )
188197 expect ( decorations ) . toEqual ( [
189- getDecorationFromHunk ( FIXTURE_HUNK_1 , NOW , 0 , SOURCEGRAPH as any ) ,
190- getDecorationFromHunk ( FIXTURE_HUNK_2 , NOW , 1 , SOURCEGRAPH as any ) ,
191- getDecorationFromHunk ( FIXTURE_HUNK_3 , NOW , 2 , SOURCEGRAPH as any ) ,
192- getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , SOURCEGRAPH as any ) ,
198+ getDecorationFromHunk ( FIXTURE_HUNK_1 , NOW , 0 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
199+ getDecorationFromHunk ( FIXTURE_HUNK_2 , NOW , 1 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
200+ getDecorationFromHunk ( FIXTURE_HUNK_3 , NOW , 2 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
201+ getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
193202 ] )
194203 } )
195204
@@ -204,9 +213,12 @@ describe('getBlameDecorationsForSelections()', () => {
204213 ] ,
205214 [ new SOURCEGRAPH . Selection ( new SOURCEGRAPH . Position ( 2 , 0 ) , new SOURCEGRAPH . Position ( 2 , 0 ) ) as any ] ,
206215 NOW ,
216+ { 'git.blame.showPreciseDate' : false } ,
207217 SOURCEGRAPH as any
208218 )
209- expect ( decorations ) . toEqual ( [ getDecorationFromHunk ( FIXTURE_HUNK_1 , NOW , 2 , SOURCEGRAPH as any ) ] )
219+ expect ( decorations ) . toEqual ( [
220+ getDecorationFromHunk ( FIXTURE_HUNK_1 , NOW , 2 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
221+ ] )
210222 } )
211223} )
212224
@@ -216,13 +228,14 @@ describe('getAllBlameDecorations()', () => {
216228 getAllBlameDecorations (
217229 [ FIXTURE_HUNK_1 , FIXTURE_HUNK_2 , FIXTURE_HUNK_3 , FIXTURE_HUNK_4 ] ,
218230 NOW ,
231+ { 'git.blame.showPreciseDate' : false } ,
219232 SOURCEGRAPH as any
220233 )
221234 ) . toEqual ( [
222- getDecorationFromHunk ( FIXTURE_HUNK_1 , NOW , 0 , SOURCEGRAPH as any ) ,
223- getDecorationFromHunk ( FIXTURE_HUNK_2 , NOW , 1 , SOURCEGRAPH as any ) ,
224- getDecorationFromHunk ( FIXTURE_HUNK_3 , NOW , 2 , SOURCEGRAPH as any ) ,
225- getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , SOURCEGRAPH as any ) ,
235+ getDecorationFromHunk ( FIXTURE_HUNK_1 , NOW , 0 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
236+ getDecorationFromHunk ( FIXTURE_HUNK_2 , NOW , 1 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
237+ getDecorationFromHunk ( FIXTURE_HUNK_3 , NOW , 2 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
238+ getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
226239 ] )
227240 } )
228241} )
@@ -233,17 +246,18 @@ describe('getBlameDecorations()', () => {
233246 getBlameDecorations ( {
234247 settings : {
235248 'git.blame.decorations' : 'line' ,
249+ 'git.blame.showPreciseDate' : false ,
236250 } ,
237251 now : NOW ,
238252 selections : null ,
239253 hunks : [ FIXTURE_HUNK_1 , FIXTURE_HUNK_2 , FIXTURE_HUNK_3 , FIXTURE_HUNK_4 ] ,
240254 sourcegraph : SOURCEGRAPH as any ,
241255 } )
242256 ) . toEqual ( [
243- getDecorationFromHunk ( FIXTURE_HUNK_1 , NOW , 0 , SOURCEGRAPH as any ) ,
244- getDecorationFromHunk ( FIXTURE_HUNK_2 , NOW , 1 , SOURCEGRAPH as any ) ,
245- getDecorationFromHunk ( FIXTURE_HUNK_3 , NOW , 2 , SOURCEGRAPH as any ) ,
246- getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , SOURCEGRAPH as any ) ,
257+ getDecorationFromHunk ( FIXTURE_HUNK_1 , NOW , 0 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
258+ getDecorationFromHunk ( FIXTURE_HUNK_2 , NOW , 1 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
259+ getDecorationFromHunk ( FIXTURE_HUNK_3 , NOW , 2 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
260+ getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
247261 ] )
248262 } )
249263
@@ -260,7 +274,9 @@ describe('getBlameDecorations()', () => {
260274 hunks : [ FIXTURE_HUNK_1 , FIXTURE_HUNK_2 , FIXTURE_HUNK_3 , FIXTURE_HUNK_4 ] ,
261275 sourcegraph : SOURCEGRAPH as any ,
262276 } )
263- ) . toEqual ( [ getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , SOURCEGRAPH as any ) ] )
277+ ) . toEqual ( [
278+ getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
279+ ] )
264280 } )
265281
266282 it ( 'gets no decorations if git.blame.decorations is "none"' , async ( ) => {
@@ -291,23 +307,33 @@ describe('getBlameDecorations()', () => {
291307 sourcegraph : SOURCEGRAPH as any ,
292308 } )
293309 ) . toEqual ( [
294- getDecorationFromHunk ( FIXTURE_HUNK_1 , NOW , 0 , SOURCEGRAPH as any ) ,
295- getDecorationFromHunk ( FIXTURE_HUNK_2 , NOW , 1 , SOURCEGRAPH as any ) ,
296- getDecorationFromHunk ( FIXTURE_HUNK_3 , NOW , 2 , SOURCEGRAPH as any ) ,
297- getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , SOURCEGRAPH as any ) ,
310+ getDecorationFromHunk ( FIXTURE_HUNK_1 , NOW , 0 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
311+ getDecorationFromHunk ( FIXTURE_HUNK_2 , NOW , 1 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
312+ getDecorationFromHunk ( FIXTURE_HUNK_3 , NOW , 2 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
313+ getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , { 'git.blame.showPreciseDate' : false } , SOURCEGRAPH as any ) ,
298314 ] )
299315 } )
300316
301317 it ( 'renders username in decoration content message' , async ( ) => {
302318 expect (
303- getDecorationFromHunk ( FIXTURE_HUNK_4 , NOW , 3 , SOURCEGRAPH as any ) . after ! . contentText ! . startsWith (
319+ getDecorationFromHunk (
320+ FIXTURE_HUNK_4 ,
321+ NOW ,
322+ 3 ,
323+ { 'git.blame.showPreciseDate' : false } ,
324+ SOURCEGRAPH as any
325+ ) . after ! . contentText ! . startsWith (
304326 `(${ FIXTURE_HUNK_4 . author . person . user ! . username } ) ${ FIXTURE_HUNK_4 . author . person . displayName } `
305327 )
306328 ) . toBe ( true )
307329 expect (
308- getDecorationFromHunk ( FIXTURE_HUNK_3 , NOW , 2 , SOURCEGRAPH as any ) . after ! . contentText ! . startsWith (
309- `${ FIXTURE_HUNK_3 . author . person . displayName } `
310- )
330+ getDecorationFromHunk (
331+ FIXTURE_HUNK_3 ,
332+ NOW ,
333+ 2 ,
334+ { 'git.blame.showPreciseDate' : false } ,
335+ SOURCEGRAPH as any
336+ ) . after ! . contentText ! . startsWith ( `${ FIXTURE_HUNK_3 . author . person . displayName } ` )
311337 ) . toBe ( true )
312338 } )
313339} )
@@ -321,6 +347,7 @@ describe('getBlameStatusBarItem()', () => {
321347 ] ,
322348 hunks : [ FIXTURE_HUNK_1 , FIXTURE_HUNK_2 , FIXTURE_HUNK_3 , FIXTURE_HUNK_4 ] ,
323349 sourcegraph : SOURCEGRAPH as any ,
350+ settings : { 'git.blame.showPreciseDate' : false } ,
324351 now : NOW ,
325352 } ) . text
326353 ) . toBe ( 'Author: (testUserName) i, 2 months ago' )
@@ -332,6 +359,7 @@ describe('getBlameStatusBarItem()', () => {
332359 selections : [ ] ,
333360 hunks : [ FIXTURE_HUNK_1 , FIXTURE_HUNK_2 , FIXTURE_HUNK_3 , FIXTURE_HUNK_4 ] ,
334361 sourcegraph : SOURCEGRAPH as any ,
362+ settings : { 'git.blame.showPreciseDate' : false } ,
335363 now : NOW ,
336364 } ) . text
337365 ) . toBe ( 'Author: e, 21 days ago' )
@@ -341,6 +369,7 @@ describe('getBlameStatusBarItem()', () => {
341369 selections : null ,
342370 hunks : [ FIXTURE_HUNK_1 , FIXTURE_HUNK_2 , FIXTURE_HUNK_3 , FIXTURE_HUNK_4 ] ,
343371 sourcegraph : SOURCEGRAPH as any ,
372+ settings : { 'git.blame.showPreciseDate' : false } ,
344373 now : NOW ,
345374 } ) . text
346375 ) . toBe ( 'Author: e, 21 days ago' )
0 commit comments