mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.4 KiB
73 lines
2.4 KiB
const fetch = require('node-fetch');
|
|
|
|
module.exports = () => describe('Test loading a bunch of pages', () => {
|
|
|
|
test('/boards.html', async () => {
|
|
const response = await fetch('http://localhost/boards.html');
|
|
expect(response.ok).toBe(true);
|
|
});
|
|
|
|
test('/boards.json', async () => {
|
|
const response = await fetch('http://localhost/boards.json');
|
|
expect(response.ok).toBe(true);
|
|
expect((await response.json()).boards.length).toBeGreaterThan(0);
|
|
});
|
|
|
|
test('/boards.html with query search for existing board', async () => {
|
|
const response = await fetch('http://localhost/boards.html?search=test&sort=popularity&direction=desc');
|
|
expect(response.ok).toBe(true);
|
|
});
|
|
|
|
test('/boards.json with query search for existing board', async () => {
|
|
const response = await fetch('http://localhost/boards.json?search=test&sort=popularity&direction=desc');
|
|
expect(response.ok).toBe(true);
|
|
expect((await response.json()).boards.length).toBeGreaterThan(0);
|
|
});
|
|
|
|
test('/boards.json with query search for not existing board', async () => {
|
|
const response = await fetch('http://localhost/boards.json?search=notexistingboard');
|
|
expect(response.ok).toBe(true);
|
|
expect((await response.json()).boards.length).toBe(0);
|
|
});
|
|
|
|
test('/overboard.html', async () => {
|
|
const response = await fetch('http://localhost/overboard.html');
|
|
expect(response.ok).toBe(true);
|
|
});
|
|
|
|
test('/overboard.json', async () => {
|
|
const response = await fetch('http://localhost/overboard.json');
|
|
expect(response.ok).toBe(true);
|
|
});
|
|
|
|
test('/overboard.html with query', async () => {
|
|
const response = await fetch('http://localhost/overboard.html?add=test&rem=abc');
|
|
expect(response.ok).toBe(true);
|
|
});
|
|
|
|
test('/overboard.json with query', async () => {
|
|
const response = await fetch('http://localhost/overboard.json?add=test&rem=abc');
|
|
expect(response.ok).toBe(true);
|
|
});
|
|
|
|
test('/index.html', async () => {
|
|
const response = await fetch('http://localhost/index.html');
|
|
expect(response.ok).toBe(true);
|
|
});
|
|
|
|
test('/news.html', async () => {
|
|
const response = await fetch('http://localhost/news.html');
|
|
expect(response.ok).toBe(true);
|
|
});
|
|
|
|
test('/rules.html', async () => {
|
|
const response = await fetch('http://localhost/rules.html');
|
|
expect(response.ok).toBe(true);
|
|
});
|
|
|
|
test('/faq.html', async () => {
|
|
const response = await fetch('http://localhost/faq.html');
|
|
expect(response.ok).toBe(true);
|
|
});
|
|
|
|
});
|
|
|