66import * as vscode from 'vscode'
77import * as sinon from 'sinon'
88import assert from 'assert'
9+ import * as path from 'path'
910import {
1011 FileSnapshot ,
1112 FileTrackerConfig ,
@@ -51,7 +52,7 @@ describe('PredictionTracker', function () {
5152 let mockDocument : vscode . TextDocument
5253
5354 beforeEach ( function ( ) {
54- filePath = '/ path/to/ file.js'
55+ filePath = path . join ( ' path' , 'to' , ' file.js')
5556 previousContent = 'previous content'
5657 tracker = new PredictionTracker ( mockExtensionContext )
5758
@@ -126,8 +127,8 @@ describe('PredictionTracker', function () {
126127 }
127128 tracker = new PredictionTracker ( mockExtensionContext , customConfig )
128129
129- const file1 = '/ path/to/ file1.js'
130- const file2 = '/ path/to/ file2.js'
130+ const file1 = path . join ( ' path' , 'to' , ' file1.js')
131+ const file2 = path . join ( ' path' , 'to' , ' file2.js')
131132
132133 const initialTime = globals . clock . Date . now ( )
133134
@@ -160,12 +161,12 @@ describe('PredictionTracker', function () {
160161 } )
161162
162163 it ( 'should return empty array for non-existent file' , function ( ) {
163- const result = tracker . getFileSnapshots ( '/ non-existent/ file.js')
164+ const result = tracker . getFileSnapshots ( path . join ( ' non-existent' , ' file.js') )
164165 assert . deepStrictEqual ( result , [ ] )
165166 } )
166167
167168 it ( 'should return snapshots for existing file' , async function ( ) {
168- const file = '/ path/to/ file.js'
169+ const file = path . join ( ' path' , 'to' , ' file.js')
169170 const content = 'file content'
170171 const mockDocument = createMockDocument ( content , file )
171172 await tracker . processEdit ( mockDocument , content )
@@ -184,7 +185,7 @@ describe('PredictionTracker', function () {
184185
185186 beforeEach ( async function ( ) {
186187 tracker = new PredictionTracker ( mockExtensionContext )
187- file = '/ path/to/ file.js'
188+ file = path . join ( ' path' , 'to' , ' file.js')
188189 snapshotContent = 'snapshot content'
189190 const mockDocument = createMockDocument ( snapshotContent , file )
190191 await tracker . processEdit ( mockDocument , snapshotContent )
@@ -207,7 +208,7 @@ describe('PredictionTracker', function () {
207208
208209 // Mock active editor, we only care about document
209210 mockEditor = {
210- document : createMockDocument ( 'current content' , '/ path/to/ active.js') ,
211+ document : createMockDocument ( 'current content' , path . join ( ' path' , 'to' , ' active.js') ) ,
211212 selection : new vscode . Selection ( 0 , 0 , 0 , 0 ) ,
212213 selections : [ new vscode . Selection ( 0 , 0 , 0 , 0 ) ] ,
213214 options : { } ,
@@ -233,7 +234,7 @@ describe('PredictionTracker', function () {
233234 } )
234235
235236 it ( 'should generate and return supplemental contexts' , async function ( ) {
236- const filePath = '/ path/to/ active.js'
237+ const filePath = path . join ( ' path' , 'to' , ' active.js')
237238 const initialTime = globals . clock . Date . now ( )
238239
239240 const mockDoc = createMockDocument ( 'old content 1' , filePath )
0 commit comments