diff options
author | nodiscc <nodiscc@gmail.com> | 2020-01-29 17:44:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-29 17:44:25 +0000 |
commit | 400424aa12c0e9e9337a80e09c41e86940835d55 (patch) | |
tree | c2ad06ea9a04a161cf664648739676c23eb6f0e4 | |
parent | Merge pull request #1953 from naresharelli/add-alfresco (diff) | |
parent | Update regex pattern to allow Clients. (diff) | |
download | awesome-selfhosted-400424aa12c0e9e9337a80e09c41e86940835d55.tar.gz awesome-selfhosted-400424aa12c0e9e9337a80e09c41e86940835d55.zip |
Merge pull request #1959 from awesome-selfhosted/fixTest
Update regex pattern to allow Clients.
-rw-r--r-- | tests/test.js | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/tests/test.js b/tests/test.js index 6516ab07..879e4fdd 100644 --- a/tests/test.js +++ b/tests/test.js @@ -16,32 +16,11 @@ function split(text) { // Function to split lines into array return text.split(/\r?\n/); } -function findPattern(text) { // Test entries against 8 patterns. If matches pattern returns true - const nodnospatt = /^\s{0,2}-\s\[.*?\]\(.*?\) - .{0,249}?\. `.*?` `.*?`/; // Regex for entries with no demo and no source code - const slpatt = /^\s{0,2}-\s\[.*?\]\(.*?\) - .{0,249}?\. \(\[Demo\b\]\(.*?\), \[Source Code\b\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with demo and source code - const nodpatt = /^\s{0,2}-\s\[.*?\]\(.*?\) - .{0,249}?\. \(\[Source Code\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with no demo - const nospatt = /^\s{0,2}-\s\[.*?\]\(.*?\) - .{0,249}?\. \(\[Demo\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with no source code - const pnodnospatt = /^\s{0,2}-\s\[.*?\]\(.*?\) `⚠` - .{0,249}?\. `.*?` `.*?`/; // Regex for entries with proprietary with no demo and no source code - const pslpatt = /^\s{0,2}-\s\[.*?\]\(.*?\) `⚠` - .{0,249}?\. \(\[Demo\b\]\(.*?\), \[Source Code\b\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with proprietary with demo and source code - const pnodpatt = /^\s{0,2}-\s\[.*?\]\(.*?\) `⚠` - .{0,249}?\. \(\[Source Code\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with proprietary with no demo - const pnospatt = /^\s{0,2}-\s\[.*?\]\(.*?\) `⚠` - .{0,249}?\. \(\[Demo\]\(.*?\)\) `.*?` `.*?`/; // Regex for entries with proprietary with no source code - if (nodnospatt.test(text) === true) { +function findPattern(text) { // All entries should match this pattern. If matches pattern returns true. + const patt = /^\s{0,2}-\s\[.*?\]\(.*?\) (`⚠` )?- .{0,249}?\.( \(\[(Demo|Source Code|Clients)\]\([^)]*\)(, \[(Source Code|Clients)\]\([^)]*\))?(, \[(Source Code|Clients)\]\([^)]*\))*\))? \`.*?\` \`.*?\`$/; + if (patt.test(text) === true) { return true; - } else if (slpatt.test(text) === true) { - return true; - } else if (nodpatt.test(text) === true) { - return true; - } else if (nospatt.test(text) === true) { - return true; - } else if (pnodnospatt.test(text) === true) { - return true; - } else if (pslpatt.test(text) === true) { - return true; - } else if (pnodpatt.test(text) === true) { - return true; - } else if (pnospatt.test(text) === true) { - return true; - } + } return false; } @@ -59,7 +38,7 @@ function entryErrorCheck(md) { for (let i = 0, len = entries.length; i < len; i += 1) { // Loop to create array of objects entryArray[i] = new Object; entryArray[i].raw = entries[i]; - if (entryFilter(entries[i]) === true) { // filter out lines that don't with * [) + if (entryFilter(entries[i]) === true) { // filter out lines that don't start with * [) total += 1; entryArray[i].name = namepatt.exec(entries[i])[1]; // Parses name of entry entryArray[i].pass = findPattern(entries[i]); // Tests against known patterns |