-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fb10da
commit e7f0c81
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import {expect} from '@jest/globals'; | ||
|
||
import * as YAML from 'js-yaml'; | ||
|
||
export const readFile = async (_filePath: string, _format: string) => { | ||
Check warning on line 5 in src/__mocks__/fs/index.ts GitHub Actions / build
|
||
return ` | ||
name: gsf-demo | ||
description: | ||
Hello | ||
tags: | ||
kind: web | ||
complexity: moderate | ||
category: cloud | ||
initialize: | ||
models: | ||
- name: boavizta-cpu | ||
kind: builtin | ||
config: | ||
allocation: LINEAR | ||
verbose: true | ||
graph: | ||
children: | ||
front-end: | ||
pipeline: | ||
- boavizta-cpu | ||
config: | ||
boavizta-cpu: | ||
core-units: 24 | ||
processor: Intel® Core™ i7-1185G7 | ||
observations: | ||
- timestamp: 2023-07-06T00:00 # [KEYWORD] [NO-SUBFIELDS] time when measurement occurred | ||
duration: 3600 # Secs | ||
cpu-util: 18.392 | ||
- timestamp: 2023-08-06T00:00 # [KEYWORD] [NO-SUBFIELDS] time when measurement occurred | ||
duration: 3600 # Secs | ||
cpu-util: 16`; | ||
}; | ||
|
||
export const mkdir = (dirPath: string, _object: any) => dirPath; | ||
|
||
export const writeFile = async (pathToFile: string, content: string) => { | ||
if (pathToFile === 'reject') { | ||
throw Error('Wrong file path'); | ||
} | ||
|
||
const mockPathToFile = 'mock-pathToFile'; | ||
const mockContent = { | ||
name: 'mock-name', | ||
}; | ||
const mockObject = YAML.dump(mockContent, {noRefs: true}); | ||
|
||
expect(pathToFile).toBe(mockPathToFile); | ||
expect(content).toBe(mockObject); | ||
}; |