Merge pull request #279 from godyuo/develop
test: update QTT-002, QTT-003 test script
This commit is contained in:
5
backend-api/.gitignore
vendored
5
backend-api/.gitignore
vendored
@@ -5,9 +5,8 @@ config.serverless.yml
|
||||
.ormconfig.json
|
||||
vanillameta
|
||||
bigquery-key.json
|
||||
test-connect-info.json
|
||||
|
||||
|
||||
test_connect_info.json
|
||||
.
|
||||
# compiled output
|
||||
/dist
|
||||
/node_modules
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
"json",
|
||||
"ts"
|
||||
],
|
||||
"testTimeout": 20000,
|
||||
"rootDir": ".",
|
||||
"testRegex": ".*\\.spec\\.ts$",
|
||||
"transform": {
|
||||
|
||||
@@ -5,14 +5,18 @@ import { Database } from "../../src/database/entities/database.entity";
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { TableQuery } from "../../src/widget/tabel-query/entity/table-query.entity";
|
||||
import { WidgetService } from "../../src/widget/widget.service";
|
||||
import * as widgetTestoption from "../../widgetTestoption-10.json"
|
||||
import * as widgetTestoption from "../../widgetTestOption-10.json";
|
||||
import { Widget } from "../../src/widget/entities/widget.entity";
|
||||
import { Component } from "../../src/component/entities/component.entity";
|
||||
import { TableQueryService } from "../../src/widget/tabel-query/table-query.service";
|
||||
import {Connection, DataSource, getConnection, getRepository } from 'typeorm';
|
||||
|
||||
|
||||
describe('Check Widget Function', () => {
|
||||
let widgetService: WidgetService;
|
||||
let widgetRepository: Widget;
|
||||
let connection: Connection;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
imports: [
|
||||
@@ -23,9 +27,11 @@ describe('Check Widget Function', () => {
|
||||
getTestMysqlModule(),
|
||||
TypeOrmModule.forFeature([Widget, Component, TableQuery, Database]),
|
||||
],
|
||||
providers: [WidgetService, TableQueryService],
|
||||
providers: [WidgetService, TableQueryService, Widget],
|
||||
}).compile();
|
||||
widgetService = module.get<WidgetService>(WidgetService);
|
||||
widgetRepository = module.get<Widget>(Widget);
|
||||
connection = module.get<Connection>(Connection);
|
||||
|
||||
}, 10000);
|
||||
|
||||
@@ -35,12 +41,24 @@ describe('Check Widget Function', () => {
|
||||
"message": "success"
|
||||
}
|
||||
}
|
||||
for(let i = 0; i < widgetTestoption['default'].length; i ++){
|
||||
it('QTT-002-01: widget 생성 확인', async() => {
|
||||
const result = await widgetService.create(Object.create(widgetTestoption['default'][i]));
|
||||
return expect(result).toBeDefined();
|
||||
});
|
||||
}
|
||||
|
||||
it('QTT-002-01: widget 생성 확인', async() => {
|
||||
|
||||
// const result = await widgetService.create(Object.create(widgetTestoption['default']))
|
||||
// widgetTestoption['default'].option = JSON.stringify(widgetTestoption['default'].option)
|
||||
widgetTestoption['default'].forEach(el => {
|
||||
el.option = JSON.stringify(el.option)
|
||||
})
|
||||
console.log(widgetTestoption['default'])
|
||||
const user = await connection
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(Widget)
|
||||
.values(widgetTestoption['default'])
|
||||
.execute()
|
||||
return expect(user).toBeDefined();
|
||||
});
|
||||
|
||||
it('QTT-002-02: widget 목록 확인', async() => {
|
||||
const result = await widgetService.findAll();
|
||||
return expect(result).toEqual(result)
|
||||
|
||||
@@ -63,7 +63,7 @@ describe('Check Widget Function', () => {
|
||||
let widgetId = [];
|
||||
let result = [];
|
||||
for(let i = 0; i < varchart.length; i ++) {
|
||||
widgetId.push(findWidgetInfo.data.filter(el => el.title === varchart[i]));
|
||||
widgetId.push(findWidgetInfo.data.filter(el => el.componentTitle === varchart[i]));
|
||||
}
|
||||
widgetId = widgetId.flat();
|
||||
result = widgetId.map(el => el.id)
|
||||
@@ -78,7 +78,6 @@ describe('Check Widget Function', () => {
|
||||
createDashboardDto.title = 'QTT-003-01 dashboard';
|
||||
createDashboardDto.layout = layoutResult.data.layout;
|
||||
const createDashboardResult = await dashboardService.create(createDashboardDto);
|
||||
|
||||
return expect(createDashboardResult.status).toEqual(ResponseStatus.SUCCESS);
|
||||
});
|
||||
|
||||
@@ -87,7 +86,7 @@ describe('Check Widget Function', () => {
|
||||
let widgetId = [];
|
||||
let result = [];
|
||||
for(let i = 0; i < linechart.length; i ++) {
|
||||
widgetId.push(findWidgetInfo.data.filter(el => el.title === linechart[i]));
|
||||
widgetId.push(findWidgetInfo.data.filter(el => el.componentTitle === linechart[i]));
|
||||
}
|
||||
widgetId = widgetId.flat();
|
||||
result = widgetId.map(el => el.id)
|
||||
@@ -102,7 +101,6 @@ describe('Check Widget Function', () => {
|
||||
createDashboardDto.title = 'QTT-003-02 dashboard';
|
||||
createDashboardDto.layout = layoutResult.data.layout;
|
||||
const createDashboardResult = await dashboardService.create(createDashboardDto);
|
||||
|
||||
return expect(createDashboardResult.status).toEqual(ResponseStatus.SUCCESS);
|
||||
});
|
||||
|
||||
@@ -111,7 +109,7 @@ describe('Check Widget Function', () => {
|
||||
let widgetId = [];
|
||||
let result = [];
|
||||
for(let i = 0; i < piechart.length; i ++) {
|
||||
widgetId.push(findWidgetInfo.data.filter(el => el.title === piechart[i]));
|
||||
widgetId.push(findWidgetInfo.data.filter(el => el.componentTitle === piechart[i]));
|
||||
}
|
||||
widgetId = widgetId.flat();
|
||||
result = widgetId.map(el => el.id)
|
||||
@@ -126,7 +124,6 @@ describe('Check Widget Function', () => {
|
||||
createDashboardDto.title = 'QTT-003-03 dashboard';
|
||||
createDashboardDto.layout = layoutResult.data.layout;
|
||||
const createDashboardResult = await dashboardService.create(createDashboardDto);
|
||||
|
||||
return expect(createDashboardResult.status).toEqual(ResponseStatus.SUCCESS);
|
||||
});
|
||||
|
||||
@@ -135,7 +132,7 @@ describe('Check Widget Function', () => {
|
||||
let widgetId = [];
|
||||
let result = [];
|
||||
for(let i = 0; i < etcchart.length; i ++) {
|
||||
widgetId.push(findWidgetInfo.data.filter(el => el.title === etcchart[i]));
|
||||
widgetId.push(findWidgetInfo.data.filter(el => el.componentTitle === etcchart[i]));
|
||||
}
|
||||
widgetId = widgetId.flat();
|
||||
result = widgetId.map(el => el.id)
|
||||
@@ -150,7 +147,6 @@ describe('Check Widget Function', () => {
|
||||
createDashboardDto.title = 'QTT-003-04 dashboard';
|
||||
createDashboardDto.layout = layoutResult.data.layout;
|
||||
const createDashboardResult = await dashboardService.create(createDashboardDto);
|
||||
|
||||
return expect(createDashboardResult.status).toEqual(ResponseStatus.SUCCESS);
|
||||
});
|
||||
|
||||
@@ -159,7 +155,7 @@ describe('Check Widget Function', () => {
|
||||
let widgetId = [];
|
||||
let result = [];
|
||||
for(let i = 0; i < etccomponent.length; i ++) {
|
||||
widgetId.push(findWidgetInfo.data.filter(el => el.title === etccomponent[i]));
|
||||
widgetId.push(findWidgetInfo.data.filter(el => el.componentTitle === etccomponent[i]));
|
||||
}
|
||||
widgetId = widgetId.flat();
|
||||
result = widgetId.map(el => el.id)
|
||||
|
||||
122
backend-api/test_connect_info.json
Normal file
122
backend-api/test_connect_info.json
Normal file
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"mysql": {
|
||||
"name": "mysql database",
|
||||
"description": "vanilla mysql - dev",
|
||||
"connectionConfig": {
|
||||
"host": "dev-sellerking-service.cpxfjdgipx1h.ap-northeast-2.rds.amazonaws.com",
|
||||
"port": 3306,
|
||||
"user": "vanillabrain",
|
||||
"password": "qkslffk123123",
|
||||
"database": "mysql_sample"
|
||||
},
|
||||
"engine": "mysql2"
|
||||
},
|
||||
"mssql": {
|
||||
"name": "mssql database",
|
||||
"description": "vanilla mssql - dev",
|
||||
"connectionConfig": {
|
||||
"host": "vanillameta-sqlserver.cpxfjdgipx1h.ap-northeast-2.rds.amazonaws.com",
|
||||
"port": 1433,
|
||||
"user": "vanillabrain",
|
||||
"password": "qkslffk123123",
|
||||
"database": "sqlserver_sample"
|
||||
},
|
||||
"engine": "mssql"
|
||||
},
|
||||
"pg": {
|
||||
"name": "pg database",
|
||||
"description": "vanilla pg - dev",
|
||||
"connectionConfig": {
|
||||
"host": "vanillameta-postgres.cpxfjdgipx1h.ap-northeast-2.rds.amazonaws.com",
|
||||
"port": 5432,
|
||||
"user": "vanillabrain",
|
||||
"password": "qkslffk123123",
|
||||
"database": "postgres_sample"
|
||||
},
|
||||
"engine": "pg"
|
||||
},
|
||||
"sqlite": {
|
||||
"name": "sqlite database",
|
||||
"description": "vanilla sqlite - dev",
|
||||
"connectionConfig": {
|
||||
"database": "sqlite_sample",
|
||||
"filename": "./sqlite_sample.sqlite"
|
||||
},
|
||||
"engine": "sqlite"
|
||||
},
|
||||
"maria": {
|
||||
"name": "maria database",
|
||||
"description": "vanilla maria - dev",
|
||||
"connectionConfig": {
|
||||
"host": "vanillameta-maria.cpxfjdgipx1h.ap-northeast-2.rds.amazonaws.com",
|
||||
"port": 3306,
|
||||
"user": "vanillabrain",
|
||||
"password": "qkslffk123123",
|
||||
"database": "maria_sample"
|
||||
},
|
||||
"engine": "mysql2"
|
||||
},
|
||||
"cockroach": {
|
||||
"name": "cockroach database",
|
||||
"description": "vanilla cockroach - dev",
|
||||
"connectionConfig": {
|
||||
"host": "free-tier8.aws-ap-southeast-1.cockroachlabs.cloud",
|
||||
"port": 26257,
|
||||
"user": "vanillaUser",
|
||||
"password": "DnkwUwzTQ7ZY-G2d3iExfA",
|
||||
"database": "defaultdb"
|
||||
},
|
||||
"engine": "cockroachdb"
|
||||
},
|
||||
"oracle": {
|
||||
"name": "oracle database",
|
||||
"description": "vanilla oracle - dev",
|
||||
"connectionConfig": {
|
||||
"host": "vanillameta-oracle.cpxfjdgipx1h.ap-northeast-2.rds.amazonaws.com",
|
||||
"port": 1521,
|
||||
"user": "vanillabrain",
|
||||
"password": "qkslffk123123",
|
||||
"database": "ORCL",
|
||||
"instanceName": "VANILLABRAIN",
|
||||
"fetchAsString": [ "number", "clob" ],
|
||||
"requestTimeout": 100
|
||||
},
|
||||
"engine": "oracledb"
|
||||
},
|
||||
"snowflake": {
|
||||
"name": "snowflake database",
|
||||
"description": "vanilla snowflake - dev",
|
||||
"connectionConfig": {
|
||||
"account": "wj84419.ap-northeast-2.aws",
|
||||
"username": "drumcap",
|
||||
"password": "FA#3GqY!Sj&Y9X",
|
||||
"database": "VANILLA",
|
||||
"application": "VANILLA_SNOWFLAKE",
|
||||
"schema": "VANILLA_SNOWFLAKE",
|
||||
"warehouse": "COMPUTE_WH"
|
||||
},
|
||||
"engine": "snowflake"
|
||||
},
|
||||
"redshift": {
|
||||
"name": "redshift test database",
|
||||
"description": "vanilla maria - dev",
|
||||
"connectionConfig": {
|
||||
"host": "redshift-cluster-2.cjp7aw9lnxzf.ap-northeast-2.redshift.amazonaws.com",
|
||||
"port": 5439,
|
||||
"user": "admin",
|
||||
"password": "Qkslffk123123",
|
||||
"database": "dev"
|
||||
},
|
||||
"engine": "pg"
|
||||
},
|
||||
"bigquery": {
|
||||
"name": "bigquery test database",
|
||||
"description": "bigquery test database",
|
||||
"connectionConfig": {
|
||||
"projectId": "vanillameta-bigquery",
|
||||
"keyFilename": "./bigquery-key.json",
|
||||
"schema": "bigquery_sample"
|
||||
},
|
||||
"engine": "bigquery"
|
||||
}
|
||||
}
|
||||
@@ -1,352 +0,0 @@
|
||||
[
|
||||
{
|
||||
"title": "숫자판",
|
||||
"description": "Score Board",
|
||||
"databaseId": 113,
|
||||
"componentId": 12,
|
||||
"datasetType": "DATASET",
|
||||
"datasetId": 27,
|
||||
"option": {
|
||||
"header": {
|
||||
"title": "평균 급여",
|
||||
"fontSize": 20,
|
||||
"color": "#4A4A4A"
|
||||
},
|
||||
"content": {
|
||||
"aggregation": "avg",
|
||||
"fontSize": 50,
|
||||
"color": "#4A4A4A",
|
||||
"field": "annualSalary",
|
||||
"numForm": true,
|
||||
"suffix": "원"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "표",
|
||||
"description": "Data Grid",
|
||||
"databaseId": 114,
|
||||
"componentId": 13,
|
||||
"datasetType": "DATASET",
|
||||
"datasetId": 28,
|
||||
"option": {
|
||||
"columns": [
|
||||
{
|
||||
"name": "yearsmarried",
|
||||
"header": "Year Merried",
|
||||
"align": "right",
|
||||
"sortable": true
|
||||
},
|
||||
{
|
||||
"name": "age",
|
||||
"header": "Age",
|
||||
"align": "right",
|
||||
"sortable": true
|
||||
},
|
||||
{
|
||||
"name": "gender",
|
||||
"header": "Gender",
|
||||
"align": "right",
|
||||
"sortable": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "선형 차트",
|
||||
"description": "Line Chart",
|
||||
"databaseId": 108,
|
||||
"componentId": 1,
|
||||
"datasetType": "DATASET",
|
||||
"datasetId": 26,
|
||||
"option": {
|
||||
"series": [
|
||||
{
|
||||
"color": "#6aa7eb",
|
||||
"aggregation": "sum",
|
||||
"field": "education"
|
||||
},
|
||||
{
|
||||
"field": "wage",
|
||||
"color": "#85c7fc",
|
||||
"aggregation": "sum"
|
||||
},
|
||||
{
|
||||
"field": "experience",
|
||||
"color": "#94c983",
|
||||
"aggregation": "sum"
|
||||
},
|
||||
{
|
||||
"field": "age",
|
||||
"color": "#c1d96a",
|
||||
"aggregation": "sum"
|
||||
}
|
||||
],
|
||||
"mark": true,
|
||||
"xField": "education",
|
||||
"legendPosition": "top"
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "영역형 차트",
|
||||
"description": "Area Chart",
|
||||
"databaseId": 108,
|
||||
"componentId": 2,
|
||||
"datasetType": "DATASET",
|
||||
"datasetId": 26,
|
||||
"option": {
|
||||
"series": [
|
||||
{
|
||||
"color": "#6aa7eb",
|
||||
"aggregation": "sum",
|
||||
"field": "education"
|
||||
},
|
||||
{
|
||||
"field": "wage",
|
||||
"color": "#85c7fc",
|
||||
"aggregation": "sum"
|
||||
},
|
||||
{
|
||||
"field": "experience",
|
||||
"color": "#94c983",
|
||||
"aggregation": "sum"
|
||||
},
|
||||
{
|
||||
"field": "age",
|
||||
"color": "#c1d96a",
|
||||
"aggregation": "sum"
|
||||
}
|
||||
],
|
||||
"mark": true,
|
||||
"xField": "education",
|
||||
"legendPosition": "top"
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "세로 막대형 차트",
|
||||
"description": "Bar Chart",
|
||||
"databaseId": 108,
|
||||
"componentId": 3,
|
||||
"datasetType": "DATASET",
|
||||
"datasetId": 26,
|
||||
"option": {
|
||||
"series": [
|
||||
{
|
||||
"color": "#6aa7eb",
|
||||
"aggregation": "sum",
|
||||
"field": "education"
|
||||
},
|
||||
{
|
||||
"field": "wage",
|
||||
"color": "#85c7fc",
|
||||
"aggregation": "sum"
|
||||
},
|
||||
{
|
||||
"field": "experience",
|
||||
"color": "#94c983",
|
||||
"aggregation": "sum"
|
||||
},
|
||||
{
|
||||
"field": "age",
|
||||
"color": "#c1d96a",
|
||||
"aggregation": "sum"
|
||||
}
|
||||
],
|
||||
"mark": true,
|
||||
"xField": "education",
|
||||
"legendPosition": "top"
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "가로 막대형 차트",
|
||||
"description": "Column Chart",
|
||||
"databaseId": 108,
|
||||
"componentId": 4,
|
||||
"datasetType": "DATASET",
|
||||
"datasetId": 26,
|
||||
"option": {
|
||||
"series": [
|
||||
{
|
||||
"color": "#6aa7eb",
|
||||
"aggregation": "sum",
|
||||
"field": "education"
|
||||
},
|
||||
{
|
||||
"field": "wage",
|
||||
"color": "#85c7fc",
|
||||
"aggregation": "sum"
|
||||
},
|
||||
{
|
||||
"field": "experience",
|
||||
"color": "#94c983",
|
||||
"aggregation": "sum"
|
||||
},
|
||||
{
|
||||
"field": "age",
|
||||
"color": "#c1d96a",
|
||||
"aggregation": "sum"
|
||||
}
|
||||
],
|
||||
"mark": true,
|
||||
"xField": "education",
|
||||
"legendPosition": "top"
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "선형과 세로 막대형 복합 차트",
|
||||
"description": "Mixed Line and Bar Chart",
|
||||
"databaseId": 114,
|
||||
"componentId": 5,
|
||||
"datasetType": "DATASET",
|
||||
"datasetId": 28,
|
||||
"option": {
|
||||
"series": [
|
||||
{
|
||||
"color": "#6aa7eb",
|
||||
"aggregation": "avg",
|
||||
"type": "line",
|
||||
"field": "education"
|
||||
},
|
||||
{
|
||||
"color": "#47a8ea",
|
||||
"aggregation": "avg",
|
||||
"type": "bar",
|
||||
"field": "occupation"
|
||||
},
|
||||
{
|
||||
"field": "yearsmarried",
|
||||
"color": "#94c983",
|
||||
"aggregation": "avg",
|
||||
"type": "bar"
|
||||
}
|
||||
],
|
||||
"label": true,
|
||||
"xField": "age",
|
||||
"legendPosition": "left",
|
||||
"mark": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "누적 선형 차트",
|
||||
"description": "Stacked Line Chart",
|
||||
"databaseId": 113,
|
||||
"componentId": 14,
|
||||
"datasetType": "DATASET",
|
||||
"datasetId": 30,
|
||||
"option": {
|
||||
"series": [
|
||||
{
|
||||
"color": "#6aa7eb",
|
||||
"aggregation": "sum",
|
||||
"field": "violent"
|
||||
},
|
||||
{
|
||||
"field": "robbery",
|
||||
"color": "#85c7fc",
|
||||
"aggregation": "sum"
|
||||
},
|
||||
{
|
||||
"field": "murder",
|
||||
"color": "#94c983",
|
||||
"aggregation": "sum"
|
||||
}
|
||||
],
|
||||
"label": "",
|
||||
"header": {
|
||||
"title": "타이틀을 입력하세요",
|
||||
"fontSize": 20,
|
||||
"color": "#4A4A4A"
|
||||
},
|
||||
"content": {
|
||||
"aggregation": "sum",
|
||||
"fontSize": 50,
|
||||
"color": "#4A4A4A"
|
||||
},
|
||||
"xField": "year",
|
||||
"mark": "",
|
||||
"legendPosition": "left"
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "누적 영역형 차트",
|
||||
"description": "Stacked Area Chart",
|
||||
"databaseId": 113,
|
||||
"componentId": 15,
|
||||
"datasetType": "DATASET",
|
||||
"datasetId": 30,
|
||||
"option": {
|
||||
"series": [
|
||||
{
|
||||
"color": "#6aa7eb",
|
||||
"aggregation": "sum",
|
||||
"field": "violent"
|
||||
},
|
||||
{
|
||||
"field": "robbery",
|
||||
"color": "#85c7fc",
|
||||
"aggregation": "sum"
|
||||
},
|
||||
{
|
||||
"field": "murder",
|
||||
"color": "#94c983",
|
||||
"aggregation": "sum"
|
||||
}
|
||||
],
|
||||
"label": "",
|
||||
"header": {
|
||||
"title": "타이틀을 입력하세요",
|
||||
"fontSize": 20,
|
||||
"color": "#4A4A4A"
|
||||
},
|
||||
"content": {
|
||||
"aggregation": "sum",
|
||||
"fontSize": 50,
|
||||
"color": "#4A4A4A"
|
||||
},
|
||||
"xField": "year",
|
||||
"mark": "",
|
||||
"legendPosition": "left"
|
||||
}
|
||||
},
|
||||
{
|
||||
"title": "누적 가로 막대형 차트",
|
||||
"description": "Stacked Column Chart",
|
||||
"databaseId": 113,
|
||||
"componentId": 16,
|
||||
"datasetType": "DATASET",
|
||||
"datasetId": 30,
|
||||
"option": {
|
||||
"series": [
|
||||
{
|
||||
"color": "#6aa7eb",
|
||||
"aggregation": "sum",
|
||||
"field": "violent"
|
||||
},
|
||||
{
|
||||
"field": "robbery",
|
||||
"color": "#85c7fc",
|
||||
"aggregation": "sum"
|
||||
},
|
||||
{
|
||||
"field": "murder",
|
||||
"color": "#94c983",
|
||||
"aggregation": "sum"
|
||||
}
|
||||
],
|
||||
"label": "",
|
||||
"header": {
|
||||
"title": "타이틀을 입력하세요",
|
||||
"fontSize": 20,
|
||||
"color": "#4A4A4A"
|
||||
},
|
||||
"content": {
|
||||
"aggregation": "sum",
|
||||
"fontSize": 50,
|
||||
"color": "#4A4A4A"
|
||||
},
|
||||
"xField": "year",
|
||||
"mark": "",
|
||||
"legendPosition": "left"
|
||||
}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user