Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should stop processing on the first error', async () => {
const testingLoader = new CSVLoader();
await db.clearAllAndLoad(fixtures);
spyOn(entities, 'save').and.callFake(entity => Promise.reject(new Error(`error-${entity.title}`)));
try {
await testingLoader.load(csvFile, template1Id);
fail('should fail');
} catch (e) {
expect(e).toEqual(new Error('error-title1'));
}
});
it('should throw the error that occurred even if it was not the first row', async () => {
beforeAll((done) => {
db.clearAllAndLoad({}).then(done);
});
beforeEach((done) => {
routes = instrumentRoutes(relationshipsRroutes);
spyOn(relationships, 'save').and.returnValue(Promise.resolve());
spyOn(relationships, 'delete').and.returnValue(Promise.resolve());
db.clearAllAndLoad({}).then(done);
});
beforeEach((done) => {
spyOn(process.stdout, 'write');
testingDB.clearAllAndLoad(fixtures).then(done).catch(catchErrors(done));
});
beforeEach(async () => {
await db.clearAllAndLoad(fixtures);
});
beforeEach(done => {
spyOn(translations, 'addContext').and.returnValue(Promise.resolve());
db.clearAllAndLoad(fixtures)
.then(done)
.catch(catchErrors(done));
});
beforeEach((done) => {
spyOn(relationships, 'saveEntityBasedReferences').and.returnValue(Promise.resolve());
spyOn(search, 'delete').and.returnValue(Promise.resolve());
spyOn(search, 'bulkIndex').and.returnValue(Promise.resolve());
mockID();
db.clearAllAndLoad(fixtures).then(done).catch(catchErrors(done));
});
beforeEach(async () => {
await testingDB.clearAllAndLoad({});
});
beforeEach((done) => {
spyOn(process.stdout, 'write');
testingDB.clearAllAndLoad(fixtures).then(done).catch(catchErrors(done));
});
beforeEach(async () => {
await testingDB.clearAllAndLoad({});
});