forked from swiftlang/swift-docc-render
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue-config-utils.spec.js
76 lines (71 loc) · 2.45 KB
/
vue-config-utils.spec.js
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
67
68
69
70
71
72
73
74
75
76
/**
* This source file is part of the Swift.org open source project
*
* Copyright (c) 2021 Apple Inc. and the Swift project authors
* Licensed under Apache License v2.0 with Runtime Library Exception
*
* See https://swift.org/LICENSE.txt for license information
* See https://swift.org/CONTRIBUTORS.txt for Swift project authors
*/
import vueConfigUtils from 'docc-render/setup-utils/vue-config-utils';
describe('vue-config-utils', () => {
beforeEach(() => {
delete process.env.VUE_APP_TITLE;
delete process.env.VUE_APP_DEV_SERVER_PROXY;
});
describe('Page Title', () => {
it('does not set a page variable if already provided', () => {
process.env.VUE_APP_TITLE = 'Foo';
vueConfigUtils();
expect(process.env.VUE_APP_TITLE).toBe('Foo');
});
it('does not set a page title if it is set to empty value', () => {
process.env.VUE_APP_TITLE = '';
vueConfigUtils();
expect(process.env.VUE_APP_TITLE).toBe('');
});
it('sets the default page title if none provided', () => {
vueConfigUtils();
expect(process.env.VUE_APP_TITLE).toBe('Documentation');
});
});
describe('options', () => {
it('generates VueCLI options', () => {
expect(vueConfigUtils())
.toEqual({
chainWebpack: expect.any(Function),
css: {
extract: false,
loaderOptions: {
scss: {
additionalData: "$build-target: 'default'; $is-target-ide: $build-target == 'ide';",
},
},
},
devServer: { proxy: { '^/(data|downloads|images|videos)': { target: 'http://localhost:8000' } } },
productionSourceMap: false,
transpileDependencies: ['swift-docc-render'],
});
});
it('generates VueCLI options, under production mode', () => {
process.env.NODE_ENV = 'production';
expect(vueConfigUtils())
.toEqual({
chainWebpack: expect.any(Function),
css: {
extract: {
ignoreOrder: true,
},
loaderOptions: {
scss: {
additionalData: "$build-target: 'default'; $is-target-ide: $build-target == 'ide';",
},
},
},
devServer: { proxy: { '^/(data|downloads|images|videos)': { target: 'http://localhost:8000' } } },
productionSourceMap: false,
transpileDependencies: ['swift-docc-render'],
});
});
});
});