mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Added basic test coverage for perform method
refs https://github.com/TryGhost/Toolbox/issues/430 - "perform()" is what gets executed by the import job for both immediate import and "inline job" import. Testing it on granular level will allow to change it with more confidence when introducing strict field mapping rules
This commit is contained in:
parent
8dc630b3a0
commit
c08d4f8ad1
1 changed files with 13 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
|||
// const testUtils = require('./utils');
|
||||
require('./utils');
|
||||
|
||||
const assert = require('assert');
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const sinon = require('sinon');
|
||||
|
@ -167,4 +168,16 @@ describe('Importer', function () {
|
|||
fileContents.should.match(/^email,labels\r\n/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('perform', function () {
|
||||
it('performs import on a single csv file', async function () {
|
||||
const importer = buildMockImporterInstance();
|
||||
|
||||
const result = await importer.perform(`${csvPath}/single-column-with-header.csv`);
|
||||
|
||||
assert.equal(result.total, 2);
|
||||
assert.equal(result.imported, 2);
|
||||
assert.equal(result.errors.length, 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue