Skip to content
On this page

@obewds/obewds-tw-config Tests

Testing Status

CURRENT STATUS

100% Coverage
100% Passing

Vitest Tests

obewds-tw-config.test.js

js
// ./tests/obewds-tw-config.test.js

import ObewdsTwConfig from '@/data/obewds-tw-config'



test('ObewdsTwConfig component imports successfully', async () => {

    expect(ObewdsTwConfig).toBeTruthy()

})



test('ObewdsTwConfig can be modified with a new bg default palette color primary value', async () => {

    let config = ObewdsTwConfig
    let testClass = 'test-class another-class'
    
    config.bg.palettes.default.colors.primary = testClass

    let result = JSON.stringify(config)

    expect(result).toContain(testClass)

})



test('ObewdsTwConfig can be extended with a new default bg palette color', async () => {

    let config = ObewdsTwConfig
    let testKey = 'testKey'
    let testClass = 'test-class'

    config.bg.palettes.default.colors[testKey] = testClass

    let result = JSON.stringify(config)

    expect(result).toContain(testKey)
    expect(result).toContain(testClass)
    
})



test('ObewdsTwConfig can be extended with a new bg palette and color', async () => {

    let config = ObewdsTwConfig
    let testPalette = 'test-palette'
    let testKey = 'test-key'
    let testClass = 'test-class another-class'
    let palette = {
        colors: {}
    }

    palette.colors[testKey] = testClass
    config.bg.palettes[testPalette] = palette

    let result = JSON.stringify(config)

    expect(result).toContain(testPalette)
    expect(result).toContain(testKey)
    expect(result).toContain(testClass)

})
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
62
63
64
65
66

obewds-tw-config-groups.test.js

js
// ./tests/obewds-tw-config-groups.test.js

// import ObewdsTwConfig from '@/data/obewds-tw-config'
import ObewdsTwConfigGroups from '@/data/obewds-tw-config-groups'



test('ObewdsTwConfigGroups component imports successfully', async () => {

    expect(ObewdsTwConfigGroups).toBeTruthy()

})



test('ObewdsTwConfigGroups can be modified with a new top level key (intended to be used to extend an ObewdsTwConfig object in an end application)', async () => {

    let designSystemKeys = ObewdsTwConfigGroups
    let newKey = 'companyComponent'

    designSystemKeys.push(newKey)

    expect(designSystemKeys).toContain(newKey)

})
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