|
1 | 1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | 2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | 3 |
|
4 | | -import { breakWord } from './helper' |
| 4 | +import { breakWord, isSameURL } from './helper' |
5 | 5 |
|
6 | | -test('break-text', () => { |
| 6 | +test('break text', () => { |
7 | 7 | expect(breakWord('Other APIs')).toEqual(['Other APIs']) |
8 | 8 | expect(breakWord('System.CodeDom')).toEqual(['System.', 'Code', 'Dom']) |
9 | 9 | expect(breakWord('System.Collections.Dictionary<string, object>')).toEqual(['System.', 'Collections.', 'Dictionary<', 'string,', ' object>']) |
10 | 10 | expect(breakWord('https://github.com/dotnet/docfx')).toEqual(['https://github.', 'com/', 'dotnet/', 'docfx']) |
11 | 11 | }) |
| 12 | + |
| 13 | +test('is same URL', () => { |
| 14 | + expect(isSameURL({ pathname: '/' }, { pathname: '/' })).toBeTruthy() |
| 15 | + expect(isSameURL({ pathname: '/index.html' }, { pathname: '/' })).toBeTruthy() |
| 16 | + expect(isSameURL({ pathname: '/a/index.html' }, { pathname: '/a' })).toBeTruthy() |
| 17 | + expect(isSameURL({ pathname: '/a/index.html' }, { pathname: '/a/' })).toBeTruthy() |
| 18 | + expect(isSameURL({ pathname: '/a' }, { pathname: '/a/' })).toBeTruthy() |
| 19 | + expect(isSameURL({ pathname: '/a/foo.html' }, { pathname: '/a/foo' })).toBeTruthy() |
| 20 | + expect(isSameURL({ pathname: '/a/foo/' }, { pathname: '/a/foo' })).toBeTruthy() |
| 21 | + expect(isSameURL({ pathname: '/a/foo/index.html' }, { pathname: '/a/foo' })).toBeTruthy() |
| 22 | + |
| 23 | + expect(isSameURL({ pathname: '/a/foo/index.html' }, { pathname: '/a/bar' })).toBeFalsy() |
| 24 | +}) |
0 commit comments