event 876 solution
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
diff --git a/tests/acceptance/8/CRITERIA.json b/tests/acceptance/8/CRITERIA.json
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..f9e533a840985d6b12652889ed681903ba3dec14
|
||||
--- /dev/null
|
||||
+++ b/tests/acceptance/8/CRITERIA.json
|
||||
@@ -0,0 +1,18 @@
|
||||
+{
|
||||
+ "schema": "elffuss-t2t/criteria@2",
|
||||
+ "issue": 8,
|
||||
+ "criteria": [
|
||||
+ {
|
||||
+ "index": 1,
|
||||
+ "tests": [
|
||||
+ "tests/acceptance/8/criteria.test.js::criterion 1"
|
||||
+ ]
|
||||
+ },
|
||||
+ {
|
||||
+ "index": 2,
|
||||
+ "tests": [
|
||||
+ "tests/acceptance/8/criteria.test.js::criterion 2"
|
||||
+ ]
|
||||
+ }
|
||||
+ ]
|
||||
+}
|
||||
diff --git a/tests/acceptance/8/criteria.test.js b/tests/acceptance/8/criteria.test.js
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..36af7b2843022927a4da91b1f43f8e87e2533827
|
||||
--- /dev/null
|
||||
+++ b/tests/acceptance/8/criteria.test.js
|
||||
@@ -0,0 +1,15 @@
|
||||
+import test from 'node:test'
|
||||
+import assert from 'node:assert/strict'
|
||||
+const mod = await import('../../../web/js/tools/clone.js')
|
||||
+
|
||||
+test('criterion 1', () => {
|
||||
+ const host = 'github.com'
|
||||
+ assert.deepEqual(mod.parseRepoUrl(`https://${host}/o/r.git/`), { host: 'github', owner: 'o', repo: 'r', branch: null })
|
||||
+ assert.equal(mod.parseRepoUrl(`https://${host}/o/r/tree/dev`).branch, 'dev')
|
||||
+})
|
||||
+
|
||||
+test('criterion 2', () => {
|
||||
+ const host = 'bitbucket.org'
|
||||
+ assert.deepEqual(mod.parseRepoUrl(`https://${host}/o/r.git/`), { host: 'bitbucket', owner: 'o', repo: 'r', branch: null })
|
||||
+ assert.throws(() => mod.parseRepoUrl('https://example.org/o/r'), Error)
|
||||
+})
|
||||
diff --git a/web/js/tools/clone.js b/web/js/tools/clone.js
|
||||
index 09ee334f934df2af3420147792b703d3e9f40209..78bf781095587319132a5c4832a2b56b72e234f4 100644
|
||||
--- a/web/js/tools/clone.js
|
||||
+++ b/web/js/tools/clone.js
|
||||
@@ -12,7 +12,7 @@ const MAX_FILE_BYTES = 4 * 1024 * 1024; // ficheros más grandes se saltan (bina
|
||||
const CONCURRENCY = 10;
|
||||
|
||||
export function parseRepoUrl(raw) {
|
||||
- const url = String(raw || '').trim().replace(/\.git$/, '').replace(/\/+$/, '');
|
||||
+ const url = String(raw || '').trim().replace(/\/+$/, '').replace(/\.git$/, '');
|
||||
let m = url.match(/^(?:https?:\/\/)?(?:www\.)?github\.com\/([\w.-]+)\/([\w.-]+)(?:\/tree\/([\w./-]+))?/i);
|
||||
if (m) return { host: 'github', owner: m[1], repo: m[2], branch: m[3] || null };
|
||||
m = url.match(/^(?:https?:\/\/)?(?:www\.)?bitbucket\.org\/([\w.-]+)\/([\w.-]+)(?:\/src\/([\w./-]+))?/i);
|
||||
1
events/0000000876.json
Normal file
1
events/0000000876.json
Normal file
@@ -0,0 +1 @@
|
||||
{"data":{"cites":[],"envelope":{"delegation":{"identity":"0x3c4b6c950e8bf72399a3f54c7141ed8c487a9daf","nonce":"1791004917","project":"0x0000000000000000000000000000000000000000000000000000000000000000","scopes":1,"sessionX":"0xd97d6b185911670c8f402511fb7ad70f9468adbe1814f48b26b19c1f0c340fd3","sessionY":"0xd9326327b20e5f216cd78bec88f35a5e1477e80f0cb4e15d4cda89fe6b9cb6f6","validFrom":"1791004857","validUntil":"1791177717"},"delegationSignature":"0xe72d87942b2e0c73918a19c3362a3ce8b3ed53af5203848d108e9ceed7aee6512b53d4a73dd2f779d9e73cc58860d3b6c47a1ea3558b93aefe62865774359ef41b","kind":"session","signature":"0xfb6793dac2ba914e09ea1fb9d1cf705bfe4a94311c147caf96850dec9e1a460678ec8d802e58ddd3b2c5ff78764123b0f42fb956e9a71da6d2c2bea06fcbc6c0"},"mainHead":null,"message":{"author":"0x3c4b6c950e8bf72399a3f54c7141ed8c487a9daf","baseCommit":"0x34e25b3bb1782986b27961da07f41ea08a1698d0","basePartial":"0x0000000000000000000000000000000000000000000000000000000000000000","citesHash":"0x0000000000000000000000000000000000000000000000000000000000000000","issueId":"0xb39df7f42e2f2a5fe2272fbd62986ee6a0738e02391e5725f8b27a3a20f68b29","issuedAt":"1791004929","lines":2,"nonce":"1791004929894","patchHash":"0x03438b1f207e02e3f855ad179915f67a07429dd3c2e402f83313c9505b9cdc79","project":"0x16d6e75341c5f21003a4d9e89b416a545f7335094d7df139fd20942c9b7fb2de","repo":"0xd822e541c0173492ca0725a08935bcd8eaa756a9559600a9427d0daac625ead2"},"pr":"elffuss/code:item/0x4f5921d5b6e4ad0bc11e3c6f077324ba0898d042b1a1bb6da05c7f07fee0fa80"},"eventHash":"0xea7a91ec6969dd96d674aba9dda1e985da5f62b2ed146ad686111779ba4d032e","gatewaySignature":"0x0a1d634a9d08ed4a79aa385af26355e92e29013774bf13cde6cd53323cf97f4b08952822befedbcfa98538c1352c667cb08cd3fd77f8312f3425bae977f048901c","prev":"0x644125d743a4f6406b2a473f785a92e6750e9e38f9302002ea53c8e095d2a182","seq":876,"ts":1791004929,"type":"solution","v":2}
|
||||
Reference in New Issue
Block a user