Sign In

@bilig/protocol

Package Overview
Dependencies
Maintainers
1
Versions
589
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bilig/protocol - npm Package Compare versions

Comparing version
0.157.0
to
0.159.0
+2
-2
package.json
{
"name": "@bilig/protocol",
"version": "0.157.0",
"version": "0.159.0",
"description": "Shared protocol types, enums, opcodes, and spreadsheet limits for bilig.",

@@ -41,3 +41,3 @@ "keywords": [

"scripts": {
"build": "tsc -p tsconfig.json"
"build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json"
},

@@ -44,0 +44,0 @@ "engines": {

import { describe, expect, it } from 'vitest';
import { ErrorCode, ValueTag } from './enums.js';
import { formatCellDisplayValue, formatGeneralNumberValue } from './formatting.js';
import { formatErrorCode } from './types.js';
describe('formatCellDisplayValue', () => {
it('renders Excel date serials without local timezone drift', () => {
expect(formatCellDisplayValue({ tag: ValueTag.Number, value: 46023 }, 'date:short')).toBe('01/01/2026');
expect(formatCellDisplayValue({ tag: ValueTag.Number, value: 46357 }, 'date:short')).toBe('12/01/2026');
});
it('uses General-format text for numeric display coercion', () => {
expect(formatGeneralNumberValue(1989)).toBe('1989');
expect(formatGeneralNumberValue(1)).toBe('1');
expect(formatGeneralNumberValue(0.1 + 0.2)).toBe('0.3');
expect(formatCellDisplayValue({ tag: ValueTag.Number, value: 0.1 + 0.2 }, 'general')).toBe('0.3');
});
it('renders Excel NULL errors without downgrading them', () => {
expect(formatErrorCode(ErrorCode.Null)).toBe('#NULL!');
expect(formatCellDisplayValue({ tag: ValueTag.Error, code: ErrorCode.Null }, undefined)).toBe('#NULL!');
});
});
//# sourceMappingURL=formatting.test.js.map
{"version":3,"file":"formatting.test.js","sourceRoot":"","sources":["../src/formatting.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE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