Skip to content

Commit ece1fe1

Browse files
authored
Merge pull request #23 from Cherry/chore/test-array-improvements
2 parents 8eb2098 + 5320f83 commit ece1fe1

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

test/problemMatcher.test.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,11 @@ describe('adds matcher', () => {
120120
});
121121

122122
await expect(htmllintProblemMatcher()).resolves.toBeUndefined();
123-
124-
let hasMatch = false;
125-
for (const log of logs) {
126-
if (typeof log === 'string' && log.includes('::add-matcher')) {
127-
hasMatch = true;
128-
break;
129-
}
130-
}
131-
expect(hasMatch).toBe(true);
123+
expect(logs).toEqual(
124+
expect.arrayContaining([
125+
expect.stringContaining('::add-matcher::'),
126+
]),
127+
);
132128
logMock.mockRestore();
133129
});
134130
});
@@ -149,15 +145,11 @@ describe('removes matcher', () => {
149145
});
150146

151147
await expect(htmllintProblemMatcher()).resolves.toBeUndefined();
152-
153-
let hasMatch = false;
154-
for (const log of logs) {
155-
if (typeof log === 'string' && log.includes('::remove-matcher')) {
156-
hasMatch = true;
157-
break;
158-
}
159-
}
160-
expect(hasMatch).toBe(true);
148+
expect(logs).toEqual(
149+
expect.arrayContaining([
150+
expect.stringContaining('::remove-matcher'),
151+
]),
152+
);
161153
logMock.mockRestore();
162154
});
163155
});

0 commit comments

Comments
 (0)