Commit 176e3a5b by Leo Zheng

修改README

parent a553f6d2
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
2. 在根目录运行:```npm install``` 2. 在根目录运行:```npm install```
3. 在VSCode编译器里按F5开始运行服务器 3. 在VSCode编译器里按F5开始运行服务器
## 测试
在根目录运行```npm test```
## 错误代码: ## 错误代码:
- 501:数据Excel文件不在指定位置 - 501:数据Excel文件不在指定位置
- 502:数据Excel文件找不到需要的表格 - 502:数据Excel文件找不到需要的表格
...@@ -82,6 +85,9 @@ ...@@ -82,6 +85,9 @@
2. In the root directory, run ```npm install``` 2. In the root directory, run ```npm install```
3. Using VScode IDE, press F5 to start the server. 3. Using VScode IDE, press F5 to start the server.
## Testing
Run ```npm test``` in the root directory
## Error Code: ## Error Code:
- 501: The Excel file storing the data is missing - 501: The Excel file storing the data is missing
- 502: The Excel sheet doesn't exist in the Excel file (Excel file is corrupted) - 502: The Excel sheet doesn't exist in the Excel file (Excel file is corrupted)
......
export function testDateError(strategy) {
expect(() => strategy.execute()).toThrow("Date parameter is required.");
expect(() => strategy.execute({})).toThrow("Date parameter is required.");
expect(() => strategy.execute({ query: {} })).toThrow("Date parameter is required.");
}
export function testSightError(strategy) {
expect(() => strategy.execute()).toThrow("Date and sight parameters are required.");
expect(() => strategy.execute({})).toThrow("Date and sight parameters are required.");
expect(() => strategy.execute({ query: {} })).toThrow("Date and sight parameters are required.");
expect(() => strategy.execute({ query: { date: '2023-07-01' } })).toThrow('Date and sight parameters are required.');
expect(() => strategy.execute({ query: { sight: 'SomeSight' } })).toThrow('Date and sight parameters are required.');
}
export function testYearError(strategy) {
expect(() => strategy.execute()).toThrow("Year parameter is required.");
expect(() => strategy.execute({})).toThrow("Year parameter is required.");
expect(() => strategy.execute({ query: {} })).toThrow("Year parameter is required.");
}
export function testStrategy(strategy, params, truthValue) {
expect(strategy.execute(params)).toEqual(truthValue);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment