-
Notifications
You must be signed in to change notification settings - Fork 89
/
Copy pathimageHomeSpec.ts
37 lines (31 loc) · 1.31 KB
/
imageHomeSpec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { buildInputFile, createImageHome } from '../src'
export default describe('imageHome', () => {
it('should allow me to register an image', async done => {
const imageHome = createImageHome()
expect(imageHome.isRegistered('fn.png')).toBeFalsy()
const r = await imageHome.register( await buildInputFile('fn.png'))
expect(r.name).toBe('fn.png')
expect(imageHome.isRegistered('fn.png')).toBeTruthy()
done()
})
it('should allow to get all images', async done => {
const imageHome = createImageHome()
await imageHome.register( await buildInputFile('fn.png'))
await imageHome.register( await buildInputFile('holocaust.jpg'))
const all = await imageHome.getAll()
expect(all.find(f => f.name === 'fn.png')).toBeTruthy()
expect(all.find(f => f.name === 'holocaust.jpg')).toBeTruthy()
done()
})
it('should addBuiltInImages()', async done => {
const imageHome = createImageHome()
let all = await imageHome.getAll()
expect(all.find(i => i.name === 'rose:')).toBeUndefined()
// const builtIn = await context.addBuiltInImages()
// expect(builtIn.find(i => i.name === 'rose:')).toBeDefined()
await imageHome.addBuiltInImages()
all = await imageHome.getAll()// .getAllFiles()
expect(all.find(i => i.name === 'rose:')).toBeDefined()
done()
})
})