chore: setup increment ci env (#109)

This commit is contained in:
tecvan
2025-07-28 17:51:31 +08:00
committed by GitHub
parent 4a44c0ddbd
commit 9dcdb70508
22 changed files with 516 additions and 55 deletions

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import path from 'path';
import {
@@ -65,7 +65,22 @@ const updateDTS = ({
// 创建一个新的文件,用来保存生成的类型定义
const typeDefs = project.createSourceFile(
outputFileName,
`/* eslint-disable */
`/*
* Copyright 2025 coze-dev Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable */
/* prettier-ignore */
// 基于${path.relative(baseDir, inputFileName)}自动生成,请勿手动修改`,
{

View File

@@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* eslint-disable */
/* prettier-ignore */
// 基于src/index.ts自动生成请勿手动修改

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import dayjs from 'dayjs';
import { I18n } from '@coze-arch/i18n';
@@ -56,8 +56,16 @@ describe('Date', () => {
expect(getCurrentTZ().utcOffset()).toBe(60 * 8);
});
it('#formatDate', () => {
const date = formatDate(1718782764);
expect(date).toBe('2024/06/19 15:39:24');
// 使用固定的时间戳,但验证格式而不是具体的时区值
const timestamp = 1718782764;
const date = formatDate(timestamp);
// 验证格式是否正确YYYY/MM/DD HH:mm:ss
expect(date).toMatch(/^\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}$/);
// 验证时间戳转换的一致性格式化后再解析应该得到相同的dayjs对象的日期部分
const formattedDayjs = dayjs(date, 'YYYY/MM/DD HH:mm:ss');
const originalDayjs = dayjs.unix(timestamp);
expect(formattedDayjs.unix()).toBe(originalDayjs.unix());
});
it('#getRemainTime', () => {
vi.useFakeTimers();
@@ -80,7 +88,7 @@ describe('Date', () => {
describe('format timestamp', () => {
beforeEach(() => {
const MOCK_NOW = dayjs('2024-09-24 20:00:00');
vi.setSystemTime(MOCK_NOW);
vi.setSystemTime(MOCK_NOW.toDate());
});
it('just now', () => {