Add WebDav server, fully functional!

Some more code cleanup.
This commit is contained in:
Bruno Bernardino
2024-04-06 19:43:34 +01:00
parent 541df3fb77
commit 265c52a7e5
11 changed files with 424 additions and 149 deletions

View File

@@ -1,7 +1,6 @@
import { assertEquals } from 'std/assert/assert_equals.ts';
import {
convertFormDataToObject,
convertObjectToDavXml,
convertObjectToFormData,
escapeHtml,
generateHash,
@@ -247,48 +246,3 @@ Deno.test('that convertObjectToFormData works', () => {
assertEquals(convertFormDataToObject(output), convertFormDataToObject(test.expected));
}
});
Deno.test('that convertObjectToDavXml works', () => {
const tests: { input: Record<string, any>; expected: string }[] = [
{
input: {
url: 'https://bewcloud.com',
},
expected: `<url>https://bewcloud.com</url>`,
},
{
input: {
a: 'Website',
a_attributes: {
href: 'https://bewcloud.com',
target: '_blank',
},
},
expected: `<a href="https://bewcloud.com" target="_blank">Website</a>`,
},
{
input: {
article: {
p: [
{
strong: 'Indeed',
},
{
i: {},
},
'Mighty!',
],
},
article_attributes: {
class: 'center',
},
},
expected: `<article class="center"><p><strong>Indeed</strong></p>\n<p><i /></p>\n<p>Mighty!</p></article>`,
},
];
for (const test of tests) {
const result = convertObjectToDavXml(test.input);
assertEquals(result, test.expected);
}
});