|
1 | | -import { check } from 'k6'; |
2 | | -import http from 'k6/http'; |
3 | | -import { defaultOptions, url } from './lib/util.js'; |
4 | | - |
5 | | -export const options = defaultOptions(); |
6 | | - |
7 | | -export default () => { |
8 | | - const streamingUrl = url('stream_async_components?delay=5'); |
9 | | - check(http.get(streamingUrl), { |
10 | | - 'status was 200': (res) => res.status === 200, |
11 | | - 'has all comments': (res) => { |
12 | | - const body = res.html().text(); |
13 | | - const commentIds = [1, 2, 3, 4]; |
14 | | - const hasAllComments = commentIds.every((commentId) => body.includes(`Comment ${commentId}`)); |
15 | | - const hasFailedRequests = !!body.match(/Request to .+ failed/i); |
16 | | - return hasAllComments && !hasFailedRequests; |
17 | | - }, |
18 | | - }); |
19 | | -}; |
| 1 | +import { check } from 'k6'; |
| 2 | +import http from 'k6/http'; |
| 3 | +import { defaultOptions, url } from './lib/util.js'; |
| 4 | + |
| 5 | +export const options = defaultOptions(); |
| 6 | + |
| 7 | +export default () => { |
| 8 | + const streamingUrl = url('stream_async_components?delay=5'); |
| 9 | + check(http.get(streamingUrl), { |
| 10 | + 'status was 200': (res) => res.status === 200, |
| 11 | + 'has all comments': (res) => { |
| 12 | + const body = res.html().text(); |
| 13 | + const commentIds = [1, 2, 3, 4]; |
| 14 | + const hasAllComments = commentIds.every((commentId) => body.includes(`Comment ${commentId}`)); |
| 15 | + const hasFailedRequests = !!body.match(/Request to .+ failed/i); |
| 16 | + return hasAllComments && !hasFailedRequests; |
| 17 | + }, |
| 18 | + }); |
| 19 | +}; |
0 commit comments