mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 04:43:35 +00:00
refactor: load project
This commit is contained in:
committed by
Carlos Valente
parent
9c5e403b18
commit
751c3329f0
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { ensureJsonExtension } from '../fileManagement.js';
|
||||
import { appendToName, ensureJsonExtension } from '../fileManagement.js';
|
||||
|
||||
describe('ensureJsonExtension', () => {
|
||||
it('should add .json to a filename without an extension', () => {
|
||||
@@ -26,3 +26,26 @@ describe('ensureJsonExtension', () => {
|
||||
expect(result).toBe('my.test.file.json');
|
||||
});
|
||||
});
|
||||
|
||||
describe('appendToName', () => {
|
||||
it('appends a given string to a file name', () => {
|
||||
const filename = 'file.json';
|
||||
const append = '(recovered)';
|
||||
const result = appendToName(filename, append);
|
||||
expect(result).toBe('file (recovered).json');
|
||||
});
|
||||
|
||||
it('handles paths', () => {
|
||||
const path = '/Users/carlos/Library/Application Support/Ontime/projects/file.json';
|
||||
const append = '(recovered)';
|
||||
const result = appendToName(path, append);
|
||||
expect(result).toBe('/Users/carlos/Library/Application Support/Ontime/projects/file (recovered).json');
|
||||
});
|
||||
|
||||
it('handles multiple . in string', () => {
|
||||
const path = 'strange.file.name.json';
|
||||
const append = '(recovered)';
|
||||
const result = appendToName(path, append);
|
||||
expect(result).toBe('strange.file.name (recovered).json');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user