focalboard/import/jira/jiraImporter.test.ts
Chen-I Lim 0e10f52317
Import jira (#1561)
* Load and parse xml

* Priority and status

* Replace foreach

* type property

* explicitArray false

* Parse description html

* Use turndown to convert html

* Allow optional priority

* Import assignee and reporter as Select

* Store original URL

* Created date

* Created date

* Update readme

* .gitignore

* Update readme

* Update import readme

* Fix readme

* Update import/jira/README.md

Fix typo.

Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>

* Remove commented out line

* Add basic Jest test

* Test that import was complete

Co-authored-by: Scott Bishel <scott.bishel@mattermost.com>
2021-10-20 09:13:53 -07:00

53 lines
1.5 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {run} from './jiraImporter'
import * as fs from 'fs'
import {ArchiveUtils} from '../../webapp/src/blocks/archive'
const inputFile = './test/jira-export.xml'
const outputFile = './test/jira.focalboard'
describe('import from Jira', () => {
test('import', async () => {
const blockCount = await run(inputFile, outputFile)
expect(blockCount === 4)
})
test('import was complete', async () => {
const archiveData = fs.readFileSync(outputFile, 'utf-8')
const blocks = ArchiveUtils.parseBlockArchive(archiveData)
console.debug(blocks)
blocks.forEach(block => {
console.log(block.title)
})
expect(blocks).toEqual(
expect.arrayContaining([
expect.objectContaining({
title: 'Jira import',
type: 'board'
}),
expect.objectContaining({
title: 'Board View',
type: 'view'
}),
expect.objectContaining({
title: 'Investigate feature area',
type: 'card'
}),
expect.objectContaining({
title: 'Investigate feature',
type: 'card'
}),
])
)
})
afterAll(() => {
fs.rmSync(outputFile)
});
})