Skip to content

Commit

Permalink
fix: converting test id to number
Browse files Browse the repository at this point in the history
  • Loading branch information
mekkyz committed Sep 18, 2023
1 parent 42b37a0 commit afa4114
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global describe, it, beforeEach, afterEach */

import React from 'react';
import expect from 'expect';
import Enzyme, { shallow } from 'enzyme';
Expand All @@ -10,17 +12,31 @@ import ResearchPlanFactory from 'factories/ResearchPlanFactory';
import ElementStore from 'src/stores/alt/stores/ElementStore';

import EditorFetcher from 'src/fetchers/EditorFetcher';
import ResearchPlanDetailsAttachments from 'src/apps/mydb/elements/details/researchPlans/attachmentsTab/ResearchPlanDetailsAttachments';
import ResearchPlanDetailsAttachments from
'src/apps/mydb/elements/details/researchPlans/attachmentsTab/ResearchPlanDetailsAttachments';

Enzyme.configure({ adapter: new Adapter() });

describe('ResearchPlanDetailsAttachments', async () => {
let stub;
beforeEach(() => { stub = sinon.stub(console, 'error'); });
afterEach(() => { stub.restore(); });

describe('.createAttachmentPreviews()', async () => {
describe('.when preview was changed', async () => {
it('new preview is rendered', async () => {
const researchPlanWithAttachment = await ResearchPlanFactory.build(
'with attachment_not_in_body'
);

// Convert id to number
if (researchPlanWithAttachment.attachments) {
researchPlanWithAttachment.attachments.forEach((attachment) => {
attachment.id = Number(attachment.id);
attachment.identifier = String(attachment.identifier);
});
}

sinon
.stub(EditorFetcher, 'initial')
.callsFake(() => new Promise(() => {}));
Expand Down

0 comments on commit afa4114

Please sign in to comment.