-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.mjs
61 lines (57 loc) · 1.94 KB
/
test.mjs
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
import assert from 'node:assert'
import test from 'node:test'
import plugin from './index.js'
const { decorateConfig } = plugin
// 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..
assert.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..
assert.deepEqual(recievedConfig, expectedConfig)
})