Skip to content

Commit 082abdd

Browse files
chrisbobbegnprice
authored andcommitted
internalLinks tests: Include hash in test-failure output
1 parent 5d0b8d2 commit 082abdd

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/utils/__tests__/internalLinks-test.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,19 @@ describe('isNarrowLink', () => {
123123

124124
describe('getLinkType', () => {
125125
const mkCheck = (expected: LinkType) => hash => {
126-
expect(getLinkType(new URL(hash, realm), realm)).toBe(expected);
126+
test(`${hash} - should return ${expected}`, () => {
127+
expect(getLinkType(new URL(hash, realm), realm)).toBe(expected);
128+
});
127129
};
128130

129-
test('link containing "stream" is a stream link', () => {
131+
describe('link containing "stream" is a stream link', () => {
130132
const check = mkCheck('stream');
131133
['/#narrow/stream/jest', '/#narrow/stream/stream/', '/#narrow/stream/topic/'].forEach(hash =>
132134
check(hash),
133135
);
134136
});
135137

136-
test('link containing "topic" is a topic link', () => {
138+
describe('link containing "topic" is a topic link', () => {
137139
const check = mkCheck('topic');
138140
[
139141
'/#narrow/stream/jest/topic/test',
@@ -145,7 +147,7 @@ describe('getLinkType', () => {
145147
].forEach(hash => check(hash));
146148
});
147149

148-
test('link containing "pm-with" is a PM link', () => {
150+
describe('link containing "pm-with" is a PM link', () => {
149151
const check = mkCheck('pm');
150152
[
151153
'/#narrow/pm-with/1,2-group',
@@ -154,14 +156,14 @@ describe('getLinkType', () => {
154156
].forEach(hash => check(hash));
155157
});
156158

157-
test('link containing "is" with valid operand is a special link', () => {
159+
describe('link containing "is" with valid operand is a special link', () => {
158160
const check = mkCheck('special');
159161
['/#narrow/is/private', '/#narrow/is/starred', '/#narrow/is/mentioned'].forEach(hash =>
160162
check(hash),
161163
);
162164
});
163165

164-
test('unexpected link shape gives "home"', () => {
166+
describe('unexpected link shape gives "home"', () => {
165167
const check = mkCheck('home');
166168
[
167169
// `near` with no operand

0 commit comments

Comments
 (0)