Skip to content

Instantly share code, notes, and snippets.

@BacLuc
Created February 6, 2025 21:36
Show Gist options
  • Save BacLuc/890f27d81473e0deaeab5cf69c99ce88 to your computer and use it in GitHub Desktop.
Save BacLuc/890f27d81473e0deaeab5cf69c99ce88 to your computer and use it in GitHub Desktop.
import { afterEach, beforeEach, expect, it, describe } from 'vitest'
/**
*
* /**
* * INFO[0010] trend for /api/camps/{id}/ not found source=console
* * INFO[0011] trend for /api/camp_collaborations?camp=%2Fapi%2Fcamps%2F4d0ddf8d7b16 not found source=console
* * INFO[0011] trend for /api/periods?camp=%2Fapi%2Fcamps%2F4d0ddf8d7b16 not found source=console
* * INFO[0013] trend for /api/activity_progress_labels?camp=%2Fapi%2Fcamps%2F4d0ddf8d7b16 not found source=console
* * INFO[0014] trend for /api/activities?camp=%2Fapi%2Fcamps%2F4d0ddf8d7b16 not found source=console
* * INFO[0015] trend for /api/material_lists?camp=%2Fapi%2Fcamps%2F4d0ddf8d7b16 not found source=console
* * INFO[0017] trend for /api/users/{id}/ not found source=console
* * @returns {string[]}
* */
it.each([
'/api/camp_collaborations?camp=%2Fapi%2Fcamps%2F4d0ddf8d7b16',
'/api/periods?camp=%2Fapi%2Fcamps%2F4d0ddf8d7b16',
'/api/activity_progress_labels?camp=%2Fapi%2Fcamps%2F4d0ddf8d7b16',
'/api/camp_collaborations?camp=%2Fapi%2Fcamps%2F4d0ddf8d7b16',
'/api/activities?camp=%2Fapi%2Fcamps%2F4d0ddf8d7b16',
'/api/material_lists?camp=%2Fapi%2Fcamps%2F4d0ddf8d7b16',
])('maps %p to %p', (input) => {
const replace = input.replace(/(\/|%2F)[0-9a-f]{6,}\/?/, "/{id}/");
expect(replace).not.toContain('4d0ddf8d7b16')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment