-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regex unit tests for getting faster feedback (#260)
- Loading branch information
Showing
5 changed files
with
46 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,7 @@ | |
], | ||
"url": "https://docs.renovatebot.com/renovate-schema.json" | ||
} | ||
] | ||
], | ||
"deno.enable": true, | ||
"deno.lint": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ | |
go-task | ||
typos | ||
gh | ||
|
||
deno | ||
]) | ||
++ (with unstables; [ | ||
dprint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// https://github.com/google/re2-wasm is not updated in this few years, however it is easy to be used than node-re2 in deno | ||
import { RE2 } from "npm:[email protected]"; | ||
|
||
import { assertEquals, assertExists } from "jsr:@std/assert@1"; | ||
|
||
import renovateDefault from "./default.json" with { type: "json" }; | ||
|
||
Deno.test("Given URL matches to correct depNameTemplate", async (t) => { | ||
const urlToTemplate = new Map<string, string>([ | ||
[`"https://plugins.dprint.dev/typescript-0.91.6.wasm"`, "dprint/dprint-plugin-{{{pluginName}}}"], | ||
[`"https://plugins.dprint.dev/json-0.19.3.wasm"`, "dprint/dprint-plugin-{{{pluginName}}}"], | ||
[`"https://plugins.dprint.dev/markdown-0.17.8.wasm"`, "dprint/dprint-plugin-{{{pluginName}}}"], | ||
[`"https://plugins.dprint.dev/toml-0.6.2.wasm"`, "dprint/dprint-plugin-{{{pluginName}}}"], | ||
[`"https://plugins.dprint.dev/dockerfile-0.3.2.wasm"`, "dprint/dprint-plugin-{{{pluginName}}}"], | ||
[`"https://plugins.dprint.dev/sql-0.2.0.wasm"`, "dprint/dprint-plugin-{{{pluginName}}}"], | ||
[`"https://plugins.dprint.dev/g-plane/malva-v0.10.1.wasm"`, "{{{user}}}/{{{pluginName}}}"], | ||
[`"https://plugins.dprint.dev/g-plane/markup_fmt-v0.12.0.wasm"`, "{{{user}}}/{{{pluginName}}}"], | ||
[`"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm"`, "{{{user}}}/{{{pluginName}}}"], | ||
[`"https://plugins.dprint.dev/g-plane/pretty_graphql-v0.2.0.wasm"`, "{{{user}}}/{{{pluginName}}}"], | ||
[`"https://plugins.dprint.dev/kachick/kdl-0.2.0.wasm"`, "{{{user}}}/dprint-plugin-{{{pluginName}}}"], | ||
]); | ||
|
||
for (const [url, template] of urlToTemplate) { | ||
await t.step(url, () => { | ||
const manager = renovateDefault.customManagers.find((cm) => | ||
cm.matchStrings.some((matcher) => { | ||
const re2 = new RE2(matcher, "u"); | ||
return re2.exec(url); | ||
}) | ||
); | ||
assertExists(manager); | ||
assertEquals(manager.depNameTemplate, template); | ||
}); | ||
} | ||
}); |