Skip to content

Commit b311b7e

Browse files
committed
Add one more test for smart truncate
1 parent 444c323 commit b311b7e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Autolinker.js
22

33
![version](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fgregjacobs%2FAutolinker.js%2Frefs%2Fheads%2Fmaster%2Fpackage.json&query=%24.version&label=Version)
4-
[![build](https://github.com/gregjacobs/Autolinker.js/actions/workflows/main.yml/badge.svg)](https://github.com/gregjacobs/Autolinker.js/actions/workflows/main.yml)
54
[![NPM Downloads](https://img.shields.io/npm/dw/autolinker)](https://www.npmjs.com/package/autolinker)
6-
[![GitHub License](https://img.shields.io/github/license/gregjacobs/Autolinker.js)](https://github.com/gregjacobs/Autolinker.js/blob/master/LICENSE)
5+
[![build](https://github.com/gregjacobs/Autolinker.js/actions/workflows/main.yml/badge.svg)](https://github.com/gregjacobs/Autolinker.js/actions/workflows/main.yml)
76
[![codecov](https://codecov.io/github/gregjacobs/Autolinker.js/graph/badge.svg?token=6sqLqa2oeb)](https://codecov.io/github/gregjacobs/Autolinker.js)
7+
[![GitHub License](https://img.shields.io/github/license/gregjacobs/Autolinker.js)](https://github.com/gregjacobs/Autolinker.js/blob/master/LICENSE)
88

99
Because I had so much trouble finding a good auto-linking implementation out in
1010
the wild, I decided to roll my own. It seemed that everything I found out there

tests/truncate/truncate-smart.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ describe('Truncate.truncate.truncateSmart', function () {
2121
expect(truncatedUrl.length).to.equal(72);
2222
});
2323

24+
it(`when just a scheme+hostname present and it's exactly the truncate length, should return it as-is`, () => {
25+
const truncatedUrl = truncateSmart('http://yahoo.com', 'http://yahoo.com'.length, '..');
26+
27+
expect(truncatedUrl).to.equal('http://yahoo.com');
28+
});
29+
2430
it(`when just a hostname is present and it's exactly the truncate length, should return it as-is`, () => {
2531
const truncatedUrl = truncateSmart('yahoo.com', 'yahoo.com'.length, '..');
2632

0 commit comments

Comments
 (0)