From b51cef3b8596ef88be799c8d7160ddd9cd4b5728 Mon Sep 17 00:00:00 2001 From: Raymonzut <40148684+Raymonzut@users.noreply.github.com> Date: Fri, 17 Apr 2020 12:03:13 +0200 Subject: [PATCH] Add hardcoded remote with postData --- src/remote.js | 7 +++++++ test/remote.js | 25 +++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/remote.js create mode 100644 test/remote.js diff --git a/src/remote.js b/src/remote.js new file mode 100644 index 0000000..c5c78ce --- /dev/null +++ b/src/remote.js @@ -0,0 +1,7 @@ +module.exports = { + postData: [ + { title: 'A walk in the park' }, + { title: 'Down the road', author: 'Alice' }, + { title: 'On a summer day', author: 'Bob' }, + ], +} diff --git a/test/remote.js b/test/remote.js new file mode 100644 index 0000000..0fbb255 --- /dev/null +++ b/test/remote.js @@ -0,0 +1,25 @@ +const assert = require('chai').assert +const remote = require('../src/remote') + +describe('remote', () => { + const data = remote.postData + + describe('postData', () => { + it('should return an array', () => { + assert.typeOf(data, 'array') + }) + it('should not be empty', () => { + assert.isAtLeast(data.length, 1) + }) + it('should contain objects', () => { + for (obj of data) { + assert.typeOf(obj, 'object') + } + }) + it('should have objects with properties', () => { + for (obj of data) { + assert.isAtLeast(Object.keys(obj).length, 1) + } + }) + }) +})