Skip to content

Commit

Permalink
Merge branch 'main' into ui-tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
acestronautical authored Feb 5, 2024
2 parents 855de4d + 46eea69 commit 13d1978
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/perfectbound.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { PerfectBound } from './perfectbound';

const testPages = [];
const testPagesEven = Array.from({length: 32}, (x, i) => i + 1);
const generatePageInfo = (page) => {return {info: page, isSigEnd: true, isSigStart: true}};

describe('PerfectBound model', () => {
it('returns config for a perfectbound booklet based on params (default)', () => {
Expand All @@ -18,7 +19,7 @@ describe('PerfectBound model', () => {
per_sheet: 4,
duplexrotate: true,
sigconfig: ['N/A'],
pagelist: [[]],
pagelistdetails: [[]],
};
const actual = new PerfectBound(testPages, testDuplex, 4, true);
expect(actual).toEqual(expected);
Expand All @@ -32,7 +33,7 @@ describe('PerfectBound model', () => {
sheets: 0,
per_sheet: 4,
sigconfig: ['N/A'],
pagelist: [[], []],
pagelistdetails: [[], []],
};
const actual = new PerfectBound(testPages, testDuplex, 4, false);
expect(actual).toEqual(expected);
Expand All @@ -46,7 +47,7 @@ describe('PerfectBound model', () => {
sheets: 8,
per_sheet: 4,
sigconfig: ['N/A'],
pagelist: [[3,2,7,6,11,10,15,14,19,18,23,22,27,26,31,30], [1,4,5,8,9,12,13,16,17,20,21,24,25,28,29,32]],
pagelistdetails: [[3,2,7,6,11,10,15,14,19,18,23,22,27,26,31,30].map(generatePageInfo), [1,4,5,8,9,12,13,16,17,20,21,24,25,28,29,32].map(generatePageInfo)],
};
const actual = new PerfectBound(testPagesEven, testDuplex, 4, false);
expect(actual).toEqual(expected);
Expand All @@ -60,7 +61,7 @@ describe('PerfectBound model', () => {
sheets: 4,
per_sheet: 8,
sigconfig: ['N/A'],
pagelist: [[4,1,7,6,12,9,15,14,20,17,23,22,28,25,31,30], [8,5,3,2,16,13,11,10,24,21,19,18,32,29,27,26]],
pagelistdetails: [[4,1,7,6,12,9,15,14,20,17,23,22,28,25,31,30].map(generatePageInfo), [8,5,3,2,16,13,11,10,24,21,19,18,32,29,27,26].map(generatePageInfo)],
};
const actual = new PerfectBound(testPagesEven, testDuplex, 8, false);
expect(actual).toEqual(expected);
Expand Down

0 comments on commit 13d1978

Please sign in to comment.