Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
cccs-jh committed Jan 21, 2025
2 parents fa49ada + a0f5dc5 commit f40dc2b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jsjaws.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
# Example:
# /*!
# * jQuery JavaScript Library v1.5
JQUERY_VERSION_REGEX = r"\/\*\!\n \* jQuery JavaScript Library v([\d\.]+)\n"
JQUERY_VERSION_REGEX = r"\/\*\!\n \* jQuery JavaScript Library v([\d\.]+(?:-[a-z0-9.]+)?)\n"

# Example:
# /**
Expand Down
2 changes: 2 additions & 0 deletions tests/test_jsjaws.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""JsJaws Service Tests"""

import os
import shutil
from hashlib import sha256
Expand Down
25 changes: 25 additions & 0 deletions tests/test_jsjaws_static.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Tests for JsJaws regexes, helper functions, etc."""

import re

import pytest

from jsjaws import JQUERY_VERSION_REGEX


@pytest.mark.parametrize(
("header", "version"),
[
("", None),
("/*!\n * jQuery JavaScript Library v1.5\n", "1.5"),
("/*!\n * jQuery JavaScript Library v3.7.1\n", "3.7.1"),
("/*!\n * jQuery JavaScript Library v3.0.0-alpha1\n", "3.0.0-alpha1"),
("/*!\n * jQuery JavaScript Library v4.0.0-beta.2\n", "4.0.0-beta.2"),
],
)
def test_JQUERY_VERSION_REGEX(header: str, version: str | None):
match = re.match(JQUERY_VERSION_REGEX, header)
if match is None:
assert version is None
else:
assert match.group(1) == version

0 comments on commit f40dc2b

Please sign in to comment.