diff --git a/bun.lockb b/bun.lockb
index 1c94024..65a10d8 100755
Binary files a/bun.lockb and b/bun.lockb differ
diff --git a/bunfig.toml b/bunfig.toml
new file mode 100644
index 0000000..986e271
--- /dev/null
+++ b/bunfig.toml
@@ -0,0 +1,2 @@
+[test]
+preload = "./happydom.ts"
\ No newline at end of file
diff --git a/happydom.ts b/happydom.ts
new file mode 100644
index 0000000..9cae201
--- /dev/null
+++ b/happydom.ts
@@ -0,0 +1,3 @@
+import { GlobalRegistrator } from "@happy-dom/global-registrator";
+
+GlobalRegistrator.register();
\ No newline at end of file
diff --git a/package.json b/package.json
index c07e890..f47098b 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
"build:dts": "dts-bundle-generator --config .dts-bundle-generator.config.json"
},
"devDependencies": {
+ "@happy-dom/global-registrator": "^12.9.1",
"@typescript-eslint/eslint-plugin": "^6.7.3",
"@typescript-eslint/parser": "^6.7.3",
"bun-types": "^1.0.3",
diff --git a/src/dash-parser/examples/mpd.ts b/src/dash-parser/examples/mpd.ts
new file mode 100644
index 0000000..332cdc1
--- /dev/null
+++ b/src/dash-parser/examples/mpd.ts
@@ -0,0 +1,28 @@
+export const testString = `
+
+
+
+
+
+
+ DASH_vodaudio_Track5.m4a
+
+
+
+
+
+
+ DASH_vodvideo_Track2.m4v
+
+
+ DASH_vodvideo_Track1.m4v
+
+
+ DASH_vodvideo_Track3.m4v
+
+
+ DASH_vodvideo_Track4.m4v
+
+
+
+ `;
diff --git a/src/dash-parser/index.ts b/src/dash-parser/index.ts
index 6f4940b..4966fc8 100644
--- a/src/dash-parser/index.ts
+++ b/src/dash-parser/index.ts
@@ -1,3 +1 @@
-export default function () {
- return 'hello from dash-parser';
-}
+export { default as parse } from './parse.ts';
diff --git a/src/dash-parser/parse.ts b/src/dash-parser/parse.ts
new file mode 100644
index 0000000..cae1c03
--- /dev/null
+++ b/src/dash-parser/parse.ts
@@ -0,0 +1,19 @@
+import { ParsedManifest } from "./types/parsedManifest";
+import { testString } from "./examples/mpd";
+
+/**
+ * Parses a MPD manifest file.
+ *
+ * @param playlist The URL of the mpd manifest to be parsed.
+ */
+export default function parse(playlist: string): ParsedManifest {
+ const parsedManifest: ParsedManifest = {
+ segments: [],
+ custom: {}
+ };
+
+ // TODO: implement parsing.
+ var doc = new DOMParser().parseFromString(testString, 'text/xml');
+
+ return parsedManifest;
+}
diff --git a/src/dash-parser/types/parsedManifest.d.ts b/src/dash-parser/types/parsedManifest.d.ts
new file mode 100644
index 0000000..5338a4c
--- /dev/null
+++ b/src/dash-parser/types/parsedManifest.d.ts
@@ -0,0 +1,5 @@
+export interface ParsedManifest {
+ // TODO: There will be more fields here
+ segments: Array;
+ custom: unknown;
+}
\ No newline at end of file
diff --git a/test/dash-parser/index.test.ts b/test/dash-parser/index.test.ts
index e61c190..a020e4b 100644
--- a/test/dash-parser/index.test.ts
+++ b/test/dash-parser/index.test.ts
@@ -1,7 +1,11 @@
+import parse from '@/dash-parser/parse';
+import { testString } from '@/dash-parser/examples/mpd';
import { describe, it, expect } from 'bun:test';
describe('dash-parser spec', () => {
- it('mock spec', () => {
- expect(true).toBe(true);
+ // TODO: create valid tests
+ it('testString should give us JSON', () => {
+ const parsed = parse(testString);
+ expect(parsed.segments.length).toBe(0);
});
});