Updated importer test to use new object return format

no issue
This commit is contained in:
Sam Lord 2022-11-14 12:30:10 +00:00
parent 56a6b5702a
commit fc291240d5
2 changed files with 3 additions and 3 deletions

View File

@ -47,7 +47,7 @@ DataImporter = {
doImport: async function doImport(importData, importOptions) {
importOptions = importOptions || {};
if (importOptions.importTag) {
if (importOptions.importTag && importData?.data?.posts) {
const tagId = ObjectId().toHexString();
if (!('tags' in importData.data)) {
importData.data.tags = [];
@ -60,7 +60,7 @@ DataImporter = {
if (!('posts_tags' in importData.data)) {
importData.data.posts_tags = [];
}
for (const post of importData.data.posts || []) {
for (const post of importData.data.posts) {
if (!('id' in post)) {
// Make sure post has an id if it doesn't already
post.id = ObjectId().toHexString();

View File

@ -401,7 +401,7 @@ describe('Importer', function () {
imageSpy.getCall(0).args[0].should.eql(expectedImages);
// we stubbed this as a noop but ImportManager calls with sequence, so we should get an array
output.should.eql([expectedImages, expectedData]);
output.should.eql({images: expectedImages, data: expectedData});
done();
}).catch(done);
});