UNPKG

1.88 kBJavaScriptView Raw
1'use strict'
2
3const analyser = require('../analyser')
4const memory = require('../adaptors/in-memory')
5const local = require('../repositories/local')
6const remote = require('../repositories/remote')
7
8describe('mygreat', () => {
9 const localInstance = local(memory([
10 { name: '20170914182600', content: { up: async (instance) => {}, down: async (instance) => {} } },
11 { name: '20170914202400', content: { up: async (instance) => {} } },
12 { name: '20170914210300', content: { up: async (instance) => {}, down: async () => { throw new Error('foo') } } },
13 { name: '20170914213400', content: { up: async (instance) => {}, down: async (instance) => {} } },
14 { name: '20170914213500', content: { up: async () => {}, down: async () => {} } },
15 ]))
16
17 const remoteInstance = remote(memory([{
18 name: '832185ad-1041-2343-2342-2a80a7c23c4b',
19 content: [
20 '20170914202400',
21 '20170914205000',
22 '20170914210300',
23 ]
24 }]))
25
26 describe('analyser(localRepository Object, remoteRepository Object): Object', () => {
27 const analyserInstance = analyser(localInstance, remoteInstance)
28
29 describe('.analyse() : Promise<Object>', () => {
30 it('returns a analysed-files-colleciton object containing all merged files from both local and remote location', () => {
31 return expect(
32 analyserInstance.analyse()
33 .then(collection => collection.all())
34 ).to.eventually.be.deep.equals([
35 { name: '20170914182600', locations: [ 'local' ] },
36 { name: '20170914202400', locations: [ 'remote', 'local' ] },
37 { name: '20170914205000', locations: [ 'remote' ] },
38 { name: '20170914210300', locations: [ 'remote', 'local' ] },
39 { name: '20170914213400', locations: [ 'local' ] },
40 { name: '20170914213500', locations: [ 'local' ] }
41 ])
42 })
43 })
44 })
45})