forked from RSG-Group/hyper-background
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
61 lines (58 loc) · 1.95 KB
/
test.js
File metadata and controls
61 lines (58 loc) · 1.95 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* eslint-env ava */
// Import Ava.
const test = require('ava')
// Import index.ts for testing.
const { decorateConfig } = require('./index')
// It should decorate config properly when empty CSS is passed.
test('it returns expected configuration on empty CSS', (t) => {
// Declare the config we must send for reference.
const configSent = {
backgroundImage: '/exampleImageWeWontResolve.png',
css: ''
}
// Save the config we recieved.
const recievedConfig = decorateConfig(configSent)
// We expect this config to be recieved.
const expectedConfig = {
backgroundImage: '/exampleImageWeWontResolve.png',
backgroundColor: 'transparent',
css: `
.hyper_main {
background: url(file:///exampleImageWeWontResolve.png) center;
background-size: cover;
}
.terms_terms {
background-color: transparent;
}
`
}
// We expect that..
t.deepEqual(recievedConfig, expectedConfig)
})
// It should decorate config properly when some CSS is passed.
test('it returns expected configuration with some custom CSS', (t) => {
// Declare the config we must send for reference.
const configSent = {
backgroundImage: '/exampleImageWeWontResolve.png',
css: 'body { background: url(file:///exampleImageWeWontResolve.png) center; }'
}
// Save the config we recieved.
const recievedConfig = decorateConfig(configSent)
// We expect this config to be recieved.
const expectedConfig = {
backgroundImage: '/exampleImageWeWontResolve.png',
backgroundColor: 'transparent',
css: `
body { background: url(file:///exampleImageWeWontResolve.png) center; }
.hyper_main {
background: url(file:///exampleImageWeWontResolve.png) center;
background-size: cover;
}
.terms_terms {
background-color: transparent;
}
`
}
// We expect that..
t.deepEqual(recievedConfig, expectedConfig)
})