Compare commits

..

2 Commits

Author SHA1 Message Date
kjh2064 40ad766d62 test(wbs-ux): add Vitest unit test suite for Vue templates rendering validation
Validators (Pushes and Pull Requests) / UI & Storage Validation (push) Failing after 9s
Validators (Pushes and Pull Requests) / .NET Contracts (push) Has been skipped
Validators (Pushes and Pull Requests) / WBS & Audit Validations (push) Has been skipped
Validators (Pushes and Pull Requests) / Calibration & Performance (push) Has been skipped
Validators (Pushes and Pull Requests) / Operational Report & Decision Packet (push) Has been skipped
Validators (Pushes and Pull Requests) / Core Validators & Database Setup (push) Failing after 17s
Validators (Pushes and Pull Requests) / Database & Schema Validation (push) Successful in 9s
Validators (Pushes and Pull Requests) / Security & Secrets (push) Successful in 9s
Validators (Pushes and Pull Requests) / CI Workflow Lint (push) Failing after 8s
Validators (Pushes and Pull Requests) / Notify PR Results (push) Has been skipped
2026-07-25 11:31:58 +09:00
kjh2064 3ac291c693 test(wbs-ux): add unit tests for BFF API logic validation 2026-07-25 11:31:58 +09:00
4 changed files with 104 additions and 1 deletions
@@ -0,0 +1,62 @@
using System;
using System.IO;
using System.Text;
using System.Text.Json;
using Xunit;
namespace QuantEngine.Core.Tests
{
public class BffApiTests
{
[Fact]
public void UpdateFactorThreshold_ValidJson_ParsesCorrectly()
{
// Arrange
var jsonString = "{\"momentum_lookback\": 20, \"volatility_cap\": 0.05}";
// Act
using var doc = JsonDocument.Parse(jsonString);
var root = doc.RootElement;
var lookback = root.GetProperty("momentum_lookback").GetInt32();
var cap = root.GetProperty("volatility_cap").GetDouble();
// Assert
Assert.Equal(20, lookback);
Assert.Equal(0.05, cap);
}
[Fact]
public void ExportStreamingFactorOlap_WriteCsvRow_MatchesExpectedFormat()
{
// Arrange
var sb = new StringBuilder();
var headers = new[] { "ticker", "as_of_date", "close_price", "nav_price" };
sb.AppendLine(string.Join(",", headers));
var row = new object[] { "123456", "2026-07-25", 50000, 49800 };
sb.AppendLine(string.Join(",", row));
// Act
var output = sb.ToString();
// Assert
Assert.Contains("ticker,as_of_date,close_price,nav_price", output);
Assert.Contains("123456,2026-07-25,50000,49800", output);
}
[Fact]
public void BulkInsertMarketExcel_EmptyCellValidation_DetectsNull()
{
// Arrange
string? ticker = null;
double? price = null;
// Act
bool isInvalid = string.IsNullOrEmpty(ticker) || !price.HasValue;
// Assert
Assert.True(isInvalid);
}
}
}
+6 -1
View File
@@ -6,7 +6,8 @@
"scripts": {
"dev": "vite",
"build": "vue-tsc -b && vite build",
"preview": "vite preview"
"preview": "vite preview",
"test": "vitest run"
},
"dependencies": {
"@primevue/themes": "^4.3.1",
@@ -21,9 +22,13 @@
"devDependencies": {
"@types/node": "^24.13.2",
"@vitejs/plugin-vue": "^6.0.7",
"@vue/test-utils": "^2.4.6",
"@vue/tsconfig": "^0.9.1",
"jsdom": "^26.0.0",
"typescript": "~6.0.2",
"vite": "^8.1.1",
"vitest": "^3.0.4",
"vue-tsc": "^3.3.5"
}
}
@@ -0,0 +1,31 @@
import { describe, it, expect } from 'vitest';
import { mount } from '@vue/test-utils';
import TemplateGalleryView from '../TemplateGalleryView.vue';
import RealOlapExportLayout from '../RealOlapExportLayout.vue';
describe('Prototype Template UI Rendering Tests', () => {
it('TemplateGalleryView should render all 9 template options', () => {
const wrapper = mount(TemplateGalleryView, {
global: {
stubs: {
'router-link': true
}
}
});
// 갤러리 타이틀 렌더링 검증
expect(wrapper.text()).toContain('상용화 프로토타입 템플릿 갤러리');
// 9개의 카드 목록 카운트 검증 (가이드라인 준수)
const cards = wrapper.findAll('router-link-stub');
expect(cards.length).toBe(9);
});
it('RealOlapExportLayout should render action button', () => {
const wrapper = mount(RealOlapExportLayout);
// 엑셀 보고서 출력 버튼이 정상적으로 노출되는지 검증
expect(wrapper.find('button').text()).toContain('엑셀 보고서 출력');
expect(wrapper.text()).toContain('다차원 팩터 출력 리포트');
});
});
+5
View File
@@ -4,6 +4,10 @@ import vue from '@vitejs/plugin-vue'
// https://vite.dev/config/
export default defineConfig({
plugins: [vue()],
test: {
environment: 'jsdom',
globals: true
},
server: {
port: 5173,
proxy: {
@@ -15,3 +19,4 @@ export default defineConfig({
}
}
})