Skip to content

Commit 4544297

Browse files
committed
update formatedEmissions
1 parent 2cd7aa3 commit 4544297

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

dist/helpers/format.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ const formatedEmissions = function (peaks, maxY) {
278278
x: k,
279279
y: ordered[k]
280280
}));
281-
return ordered.map(o => `${o.x}`).join(', ');
281+
return `λex = ${fixedWavelength} nm; λem = ${ordered.map(o => `${o.x}`).join(', ')}`;
282282
};
283283
const formatedDLSIntensity = function (peaks, maxY) {
284284
let decimal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
@@ -422,12 +422,6 @@ const peaksWrapper = function (layout, shift) {
422422
};
423423
}
424424
const ops = spectraOps[layout];
425-
if (layout === _list_layout.LIST_LAYOUT.EMISSIONS) {
426-
return {
427-
head: `${ops.head}${solvTxt}: λex = ${fixedWavelength} nm; λem = `,
428-
tail: ops.tail
429-
};
430-
}
431425
return {
432426
head: `${ops.head}${solvTxt} = `,
433427
tail: ops.tail

src/__tests__/units/helpers/format.test.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ describe('Test format helper', () => {
8989
interface ParamForPeaks {
9090
peaks: any, layout: string, decimal: number, shift: any, isAscend: boolean,
9191
isIntensity: boolean, boundary: any,
92-
integration: any, atIndex: number
92+
integration: any, atIndex: number,
93+
fixedWavelength: number
9394
}
9495
let params: ParamForPeaks
9596
beforeEach(() => {
@@ -100,7 +101,8 @@ describe('Test format helper', () => {
100101
shift: { shifts: [{ ref: LIST_SHIFT_1H[1], peak: { x: 2, y: 2 } }] },
101102
isAscend: false,
102103
isIntensity: false, boundary: {},
103-
integration: null, atIndex: 0
104+
integration: null, atIndex: 0,
105+
fixedWavelength: 10,
104106
}
105107
})
106108

@@ -137,7 +139,7 @@ describe('Test format helper', () => {
137139
it('Get peaks for Emission layout', () => {
138140
params.layout = LIST_LAYOUT.EMISSIONS
139141
const body = Format.peaksBody(params)
140-
expect(body).toEqual('2.0, 1.0')
142+
expect(body).toEqual('λex = 10 nm; λem = 2.0, 1.0')
141143
})
142144

143145

src/helpers/format.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ const formatedEmissions = (
211211

212212
ordered = Object.keys(ordered).sort(sortFunc)
213213
.map((k) => ({ x: k, y: ordered[k] }));
214-
return ordered.map((o) => `${o.x}`).join(', ');
214+
return `λex = ${fixedWavelength} nm; λem = ${ordered.map((o) => `${o.x}`)
215+
.join(', ')}`;
215216
};
216217

217218
const formatedDLSIntensity = (
@@ -347,9 +348,6 @@ const peaksWrapper = (layout, shift, atIndex = 0) => {
347348
}
348349

349350
const ops = spectraOps[layout];
350-
if (layout === LIST_LAYOUT.EMISSIONS) {
351-
return { head: `${ops.head}${solvTxt}: λex = ${fixedWavelength} nm; λem = `, tail: ops.tail };
352-
}
353351
return { head: `${ops.head}${solvTxt} = `, tail: ops.tail };
354352
};
355353

0 commit comments

Comments
 (0)