Web UI: add one UT
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 27 Aug 2022 12:44:20 +0000 (14:44 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 27 Aug 2022 12:44:20 +0000 (14:44 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/ui/web/package-lock.json
src/ui/web/package.json
src/ui/web/src/components/charging-stations/CSConnector.vue
src/ui/web/src/components/charging-stations/CSData.vue
src/ui/web/src/components/charging-stations/CSInfoModal.vue
src/ui/web/src/components/charging-stations/CSTable.vue
src/ui/web/src/views/ChargingStationsView.vue
src/ui/web/tests/unit/CSTable.spec.ts [new file with mode: 0644]

index 0a6d10b9399a509365212d4bb45cab97acc29c05..aa46a36ce4a3c2296f69b85e13a37b5030b5cc2e 100644 (file)
@@ -39,7 +39,7 @@
         "eslint-plugin-vue": "^9.4.0",
         "lint-staged": "^13.0.3",
         "prettier": "^2.7.1",
-        "typescript": "^4.8.2"
+        "typescript": "~4.8.2"
       }
     },
     "node_modules/@achrinza/node-ipc": {
index 3c790ec0c708252ef46a8ceffa3b0454b252bc00..0036763623b28dda80584810b8d8c934e902ed27 100644 (file)
@@ -2,12 +2,12 @@
   "name": "webui",
   "version": "0.1.0",
   "scripts": {
-    "start": "npm run build && node start.js",
     "serve": "vue-cli-service serve",
     "build": "vue-cli-service build",
-    "test": "vue-cli-service test:unit",
     "lint": "vue-cli-service lint",
-    "lint:fix": "vue-cli-service lint --fix"
+    "lint:fix": "vue-cli-service lint --fix",
+    "start": "npm run build && node start.js",
+    "test": "vue-cli-service test:unit"
   },
   "dependencies": {
     "core-js": "^3.25.0",
@@ -41,7 +41,7 @@
     "eslint-plugin-vue": "^9.4.0",
     "lint-staged": "^13.0.3",
     "prettier": "^2.7.1",
-    "typescript": "^4.8.2"
+    "typescript": "~4.8.2"
   },
   "_id": "webui@0.1.0",
   "gitHooks": {
index c0dd4c4465a70837d4895b87e9a55fb28bc8d8c8..81e955d036c46d1428d33da27dfff9be1617b7d8 100644 (file)
@@ -26,7 +26,7 @@ import Button from '../buttons/Button.vue';
 
 // import { reactive } from 'vue';
 import UIClient from '@/composable/UIClient';
-import { ConnectorStatus } from '@/type/ChargingStationType';
+import type { ConnectorStatus } from '@/type/ChargingStationType';
 // import Utils from '@/composable/Utils';
 
 const props = defineProps<{
index 661ea289d69a65791fbba71019c2028da6d506c7..08a72d5e6e5bb801a3a05a6fb39d36498812fcdd 100644 (file)
@@ -21,7 +21,7 @@ import CSConnector from './CSConnector.vue';
 
 // import { reactive } from 'vue';
 import Utils from '@/composable/Utils';
-import {
+import type {
   ChargingStationData,
   ChargingStationInfo,
   ConnectorStatus,
index dd7835fd847a7202bc5fe42c05bc7a17188cd488..f4505b7ddcfde52500635cf4b77c755ed513870e 100644 (file)
@@ -6,7 +6,7 @@
 
 <script setup lang="ts">
 import Modal from '@/components/Modal.vue';
-import { ChargingStationInfo } from '@/type/ChargingStationType';
+import type { ChargingStationInfo } from '@/type/ChargingStationType';
 
 const props = defineProps<{
   isVisible: boolean;
index 4cc5da9afefcd42e51a314f50bbbfa77ff50bd08..cf96d954c9e756311ae2f06f2713a974e50db4c3 100644 (file)
@@ -27,7 +27,7 @@
 
 <script setup lang="ts">
 import CSData from './CSData.vue';
-import { ChargingStationData } from '@/type/ChargingStationType';
+import type { ChargingStationData } from '@/type/ChargingStationType';
 
 const props = defineProps<{
   chargingStations: Record<string, ChargingStationData>;
index 0c781566f6022bc150e84f7f7068e1bffe734616..3ff26e54ce3ba4731885ec12cf771d105faedeae 100644 (file)
@@ -23,7 +23,7 @@ import CSTable from '@/components/charging-stations/CSTable.vue';
 
 import { onMounted, reactive } from 'vue';
 import UIClient from '@/composable/UIClient';
-import { ChargingStationData } from '@/type/ChargingStationType';
+import type { ChargingStationData } from '@/type/ChargingStationType';
 
 const UIClientInstance = UIClient.instance;
 
diff --git a/src/ui/web/tests/unit/CSTable.spec.ts b/src/ui/web/tests/unit/CSTable.spec.ts
new file mode 100644 (file)
index 0000000..28da36d
--- /dev/null
@@ -0,0 +1,26 @@
+import { expect } from 'chai';
+import { shallowMount } from '@vue/test-utils';
+import CSTable from '@/components/charging-stations/CSTable.vue';
+import type { ChargingStationData } from '@/type/ChargingStationType';
+
+describe('CSTable.vue', () => {
+  it('renders CS table columns name', () => {
+    const chargingStations: Record<string, ChargingStationData> = {
+      '0': {} as unknown as ChargingStationData,
+    };
+    const wrapper = shallowMount(CSTable, {
+      props: { chargingStations, idTag: '0' },
+    });
+    console.log(wrapper.text());
+    expect(wrapper.text()).to.include('Action');
+    expect(wrapper.text()).to.include('Connector');
+    expect(wrapper.text()).to.include('Status');
+    expect(wrapper.text()).to.include('Transaction');
+    expect(wrapper.text()).to.include('Name');
+    expect(wrapper.text()).to.include('Stopped');
+    expect(wrapper.text()).to.include('Registration Status');
+    expect(wrapper.text()).to.include('Vendor');
+    expect(wrapper.text()).to.include('Model');
+    expect(wrapper.text()).to.include('Firmware Version');
+  });
+});