bluera-knowledge 0.11.6 → 0.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,34 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { readFileSync } from 'fs';
3
+ import { join } from 'path';
4
+
5
+ /**
6
+ * Tests for validate-npm-release.sh script.
7
+ * Ensures the script follows best practices for cross-platform compatibility.
8
+ */
9
+ describe('validate-npm-release.sh', () => {
10
+ const scriptPath = join(process.cwd(), 'scripts/validate-npm-release.sh');
11
+ const scriptContent = readFileSync(scriptPath, 'utf-8');
12
+
13
+ it('does not use hardcoded /tmp paths', () => {
14
+ // Script should use mktemp -d for temporary directories, not hardcoded /tmp
15
+ // This ensures better cross-platform compatibility and avoids path collisions
16
+
17
+ // Check for hardcoded /tmp assignments (excluding comments)
18
+ const lines = scriptContent.split('\n').filter((line) => !line.trim().startsWith('#'));
19
+ const hasHardcodedTmp = lines.some((line) => /=["']?\/tmp\//.test(line));
20
+
21
+ expect(hasHardcodedTmp).toBe(false);
22
+ });
23
+
24
+ it('uses mktemp for temporary directories', () => {
25
+ // Should use mktemp -d for creating temporary directories
26
+ expect(scriptContent).toContain('mktemp -d');
27
+ });
28
+
29
+ it('cleans up temporary directories on exit', () => {
30
+ // Should have a trap to clean up on exit
31
+ expect(scriptContent).toContain('trap');
32
+ expect(scriptContent).toMatch(/rm -rf/);
33
+ });
34
+ });