-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { maxColumnLen } from "./table.js"; | ||
|
||
describe('table.js', () => { | ||
describe('maxColumnLen', () => { | ||
test('to be the longest decription field', () => { | ||
const max = maxColumnLen([{description: 'test'},{description: 'test2'}]) | ||
expect(max).toBe(5); | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { ellipsys } from "./text.js" | ||
|
||
describe('text.js', () => { | ||
describe("ellipsys", () => { | ||
test('return truncated first word if len < lenght of the first word', () => { | ||
const phrase = 'Next tick shim that prefers process.nextTick over queueMicrotask for compat' | ||
const truncated = ellipsys(phrase, 3) | ||
expect(truncated).toBe('Nex...') | ||
}) | ||
test('ellipsys return original string if its length < len', () => { | ||
const phrase = 'Next' | ||
const notTruncated = ellipsys(phrase, 10) | ||
expect(notTruncated).toBe(phrase) | ||
}) | ||
test('ellipsys return truncated string at last space if its lenght > len and len > fisrt space position ', () => { | ||
const phrase = 'Next tick shim that prefers process.nextTick over queueMicrotask for compa' | ||
const truncatedLastSpace = ellipsys(phrase, 17) | ||
expect(truncatedLastSpace).toBe('Next tick shim...') | ||
}) | ||
}) | ||
}) |