UNPKG

awwwards

Version:
62 lines (50 loc) 1.85 kB
import Awwwards from '../lib/awwwards.js'; const w = new Awwwards(); describe('Test results array', () => { test('Has at least 10 items', () => { return w.then((data) => { expect(data.length).toBeGreaterThanOrEqual(10); }); }); test('Has at least 20 items', () => { return w.then((data) => { expect(data.length).toBeGreaterThanOrEqual(20); }); }); test('Has at least 30 items', () => { return w.then((data) => { expect(data.length).toBeGreaterThanOrEqual(30); }); }); }); describe('Test results item', () => { test('Has all the properties', () => { return w.then((data) => { expect(data.shift()).toHaveProperty('image'); expect(data.shift()).toHaveProperty('title'); expect(data.shift()).toHaveProperty('site'); expect(data.shift()).toHaveProperty('link'); expect(data.shift()).toHaveProperty('date'); expect(data.shift()).toHaveProperty('author'); expect(data.shift()).toHaveProperty('category'); }); }); test('Has valid property values', () => { let url = /https:\/\/.*awwwards.com\/.*/ return w.then((data) => { expect(data.shift()).toMatchObject({ image: expect.stringMatching(url), title: expect.any(String), site: expect.stringMatching(url), link: expect.any(String), date: expect.any(String), author: { name: expect.any(String), url: expect.stringMatching(url), country: expect.any(String) }, category: expect.stringMatching(/SOTD|SOTM|SOTY|H.M|Nominees/) }); }); }); });