add tests
This commit is contained in:
parent
ada824fd8e
commit
cb5d07d343
|
@ -1,6 +1,3 @@
|
||||||
# IDE
|
|
||||||
.vscode
|
|
||||||
|
|
||||||
# deb packaging
|
# deb packaging
|
||||||
packaging/focal/cockpit-navigator
|
packaging/focal/cockpit-navigator
|
||||||
packaging/focal/cockpit-navigator.substvars
|
packaging/focal/cockpit-navigator.substvars
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"jest.rootPath": "navigator"
|
||||||
|
}
|
|
@ -75,7 +75,7 @@ $(VERSION_FILES): ./manifest.json
|
||||||
|
|
||||||
# build outputs
|
# build outputs
|
||||||
.SECONDEXPANSION:
|
.SECONDEXPANSION:
|
||||||
$(OUTPUTS): %/dist/index.html: $$(shell find $$*/src -type f) $$(shell find $$*/public -type f) $$(shell find $$* -name 'yarn.lock' -o -name 'package.json' -not -path '*node_modules*') $$*/*.html $$*/*.js
|
$(OUTPUTS): %/dist/index.html: $$(shell find $$*/src -type f -not -name *.test.js) $$(shell find $$*/public -type f) $$(shell find $$* -name 'yarn.lock' -o -name 'package.json' -not -path '*node_modules*') $$*/*.html $$*/*.js
|
||||||
@echo -e $(call cyantext,Building $*)
|
@echo -e $(call cyantext,Building $*)
|
||||||
$(NPM_PREFIX) $* install
|
$(NPM_PREFIX) $* install
|
||||||
ifeq ($(AUTO_UPGRADE_DEPS),1)
|
ifeq ($(AUTO_UPGRADE_DEPS),1)
|
||||||
|
@ -120,6 +120,12 @@ plugin-install-remote-% : INSTALL_SUFFIX=-test
|
||||||
plugin-install-remote-% : SSH=ssh $(REMOTE_TEST_USER)@$(REMOTE_TEST_HOST)
|
plugin-install-remote-% : SSH=ssh $(REMOTE_TEST_USER)@$(REMOTE_TEST_HOST)
|
||||||
plugin-install-remote-% : REMOTE_TEST_HOME=$(shell ssh $(REMOTE_TEST_USER)@$(REMOTE_TEST_HOST) 'echo $$HOME')
|
plugin-install-remote-% : REMOTE_TEST_HOME=$(shell ssh $(REMOTE_TEST_USER)@$(REMOTE_TEST_HOST) 'echo $$HOME')
|
||||||
|
|
||||||
|
.SECONDEXPANSION:
|
||||||
|
test: default $$(addprefix test-, $$(PLUGIN_SRCS))
|
||||||
|
|
||||||
|
test-%:
|
||||||
|
$(NPM_PREFIX) $* test
|
||||||
|
|
||||||
clean: FORCE
|
clean: FORCE
|
||||||
rm $(dir $(OUTPUTS)) -rf
|
rm $(dir $(OUTPUTS)) -rf
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = { presets: ['@babel/preset-env'] };
|
|
@ -0,0 +1,5 @@
|
||||||
|
module.exports = {
|
||||||
|
transform: {
|
||||||
|
"^.+\\.(js|jsx)$": "babel-jest",
|
||||||
|
},
|
||||||
|
};
|
|
@ -5,7 +5,8 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview",
|
||||||
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@45drives/regex": "^0.1.0",
|
"@45drives/regex": "^0.1.0",
|
||||||
|
@ -15,12 +16,15 @@
|
||||||
"@45drives/cockpit-css": "^0.1.5",
|
"@45drives/cockpit-css": "^0.1.5",
|
||||||
"@45drives/cockpit-helpers": "^0.1.8",
|
"@45drives/cockpit-helpers": "^0.1.8",
|
||||||
"@45drives/cockpit-syntaxes": "^0.1.4",
|
"@45drives/cockpit-syntaxes": "^0.1.4",
|
||||||
|
"@babel/preset-env": "^7.18.2",
|
||||||
"@fontsource/red-hat-text": "^4.5.4",
|
"@fontsource/red-hat-text": "^4.5.4",
|
||||||
"@headlessui/vue": "^1.5.0",
|
"@headlessui/vue": "^1.5.0",
|
||||||
"@heroicons/vue": "^1.0.6",
|
"@heroicons/vue": "^1.0.6",
|
||||||
"@tailwindcss/forms": "^0.5.0",
|
"@tailwindcss/forms": "^0.5.0",
|
||||||
"@vitejs/plugin-vue": "^2.2.0",
|
"@vitejs/plugin-vue": "^2.2.0",
|
||||||
"autoprefixer": "^10.4.2",
|
"autoprefixer": "^10.4.2",
|
||||||
|
"babel-jest": "^28.1.0",
|
||||||
|
"jest": "^28.1.0",
|
||||||
"postcss": "^8.4.8",
|
"postcss": "^8.4.8",
|
||||||
"source-sans-pro": "^3.6.0",
|
"source-sans-pro": "^3.6.0",
|
||||||
"tailwindcss": "^3.0.23",
|
"tailwindcss": "^3.0.23",
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
import assignObjectRecursive from "./assignObjectRecursive";
|
||||||
|
|
||||||
|
const defaultSource = {
|
||||||
|
str1: 'value1',
|
||||||
|
str2: 'value2',
|
||||||
|
num1: 1,
|
||||||
|
num2: 2,
|
||||||
|
bool1: true,
|
||||||
|
bool2: false,
|
||||||
|
obj1: {
|
||||||
|
str1: 'value1',
|
||||||
|
str2: 'value2',
|
||||||
|
num1: 1,
|
||||||
|
num2: 2,
|
||||||
|
bool1: true,
|
||||||
|
bool2: false,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
test('basic assignment with no defaults', () => {
|
||||||
|
const settings = {};
|
||||||
|
assignObjectRecursive(settings, defaultSource);
|
||||||
|
expect(settings).toEqual(defaultSource);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('ensure defaults do not overwrite source', () => {
|
||||||
|
const source = {
|
||||||
|
key1: 'value1',
|
||||||
|
key2: 'value2',
|
||||||
|
obj1: {
|
||||||
|
key1: 'value1',
|
||||||
|
key2: 'value2',
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue