From ce800f75adb651108e66d58bdc3e7755902f74ed Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 23 Apr 2020 11:34:32 -0400 Subject: Adding a test bed for API testing. #658 --- ui/src/api_tests/api.spec.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 ui/src/api_tests/api.spec.ts (limited to 'ui/src/api_tests') diff --git a/ui/src/api_tests/api.spec.ts b/ui/src/api_tests/api.spec.ts new file mode 100644 index 00000000..f6dfb161 --- /dev/null +++ b/ui/src/api_tests/api.spec.ts @@ -0,0 +1,13 @@ +import fetch from 'node-fetch'; + +test('adds 1 + 2 to equal 3', () => { + let sum = (a: number, b: number) => a + b; + expect(sum(1, 2)).toBe(3); +}); + +test('Get communism.lemmy.ml nodeinfo href', async () => { + let url = 'https://communism.lemmy.ml/.well-known/nodeinfo'; + let href = 'https://communism.lemmy.ml/nodeinfo/2.0.json'; + let res = await fetch(url).then(d => d.json()); + expect(res.links.href).toBe(href); +}); -- cgit v1.2.3