Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'source/master'
  • Loading branch information
skypesky committed Oct 10, 2020
commit 64dd9f28c43865d8eed996673cd5ad3560cd32e6
30 changes: 7 additions & 23 deletions spec/integration/worksheet.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -664,38 +664,22 @@ describe('Worksheet', () => {
const workbook = new ExcelJS.Workbook();

const invalidCharacters = ['*', '?', ':', '/', '\\', '[', ']'];
const expectedErrors = invalidCharacters.map(
invalidCharacter =>
`Worksheet name ${invalidCharacter} cannot include any of the following characters: * ? : \\ / [ ]`
);

for (
let lastIndex = invalidCharacters.length - 1;
lastIndex >= 0;
--lastIndex
) {
expect(() =>
workbook.addWorksheet(invalidCharacters[lastIndex])
).to.throw(expectedErrors[lastIndex]);
for (const invalidCharacter of invalidCharacters) {
expect(() => workbook.addWorksheet(invalidCharacter)).to.throw(
`Worksheet name ${invalidCharacter} cannot include any of the following characters: * ? : \\ / [ ]`
);
}
});

it('throws an error', () => {
const workbook = new ExcelJS.Workbook();

const invalidNames = ['\'sheetName', 'sheetName\''];
const expectedErrors = invalidNames.map(
invalidName =>
`The first or last character of worksheet name cannot be a single quotation mark: ${invalidName}`
);

for (
let lastIndex = invalidNames.length - 1;
lastIndex >= 0;
--lastIndex
) {
expect(() => workbook.addWorksheet(invalidNames[lastIndex])).to.throw(
expectedErrors[lastIndex]
for (const invalidName of invalidNames) {
expect(() => workbook.addWorksheet(invalidName)).to.throw(
`The first or last character of worksheet name cannot be a single quotation mark: ${invalidName}`
);
}
});
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.