Skip to content

Commit

Permalink
Add test for writeTsv
Browse files Browse the repository at this point in the history
  • Loading branch information
julieg18 committed Jul 17, 2023
1 parent d7bdb14 commit 831ccc7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion extension/src/fileSystem/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
getModifiedTime,
findOrCreateDvcYamlFile,
writeJson,
writeCsv
writeCsv,
writeTsv
} from '.'
import { dvcDemoPath } from '../test/util'
import { DOT_DVC } from '../cli/dvc/constants'
Expand Down Expand Up @@ -87,6 +88,21 @@ describe('writeCsv', () => {
})
})

describe('writeTsv', () => {
it('should write tsv into given file', async () => {
await writeTsv('file-name.tsv', [
{ nested: { string: 'string1' }, value: 3 },
{ nested: { string: 'string2' }, value: 4 },
{ nested: { string: 'string3' }, value: 6 }
])

expect(mockedWriteFileSync).toHaveBeenCalledWith(
'file-name.tsv',
'nested.string\tvalue\nstring1\t3\nstring2\t4\nstring3\t6'
)
})
})

describe('findDvcRootPaths', () => {
it('should find the dvc root if it exists in the given folder', async () => {
const dvcRoots = await findDvcRootPaths(dvcDemoPath)
Expand Down

0 comments on commit 831ccc7

Please sign in to comment.