@remote.it/core
Version:
Core remote.it JavasScript/TypeScript library
26 lines (21 loc) • 603 B
text/typescript
import { JSONFile } from './JSONFile'
import { TempFilePath } from './TempFilePath'
interface MockJSON {
foo: string
}
class MockJSONFile extends JSONFile<MockJSON> {
constructor(public location: string) {
super(location)
}
}
describe('JSONFile', () => {
test('should allow managing of a JSON file with typing support', async () => {
const tmpPath = new TempFilePath().toString()
const c = new MockJSONFile(tmpPath)
c.write({ foo: '' })
expect(c.read()).toEqual({ foo: '' })
c.write({ foo: 'bar' })
expect(c.read()).toEqual({ foo: 'bar' })
c.remove()
})
})