Test ini file matrix.
This commit is contained in:
parent
26234c2478
commit
48807e59f0
2 changed files with 7 additions and 4 deletions
|
@ -72,15 +72,17 @@ describe('Settings', () => {
|
|||
describe('#setMatrix()', () => {
|
||||
const readFileMock = jest.spyOn(require('fs/promises'), 'readFile');
|
||||
|
||||
it('should set matrix from GraphicsConfiguration.xml', (done) => {
|
||||
it.each([
|
||||
{ file: 'GraphicsConfiguration.xml', contents: mockSettings.graphicsConfigXml },
|
||||
{ file: 'XML-Profile.ini', contents: mockSettings.xmlProfileIni },
|
||||
])('should set matrix from $file', ({ file, contents }, done) => {
|
||||
const settingsFile = {
|
||||
minValue: 500000,
|
||||
maxDistance: 10000,
|
||||
matrixFile: 'GraphicsConfiguration.xml',
|
||||
matrixFile: file,
|
||||
};
|
||||
require('fs').__setFileContents(JSON.stringify(settingsFile));
|
||||
const matrixFile = mockSettings.graphicsConfigXml;
|
||||
readFileMock.mockResolvedValue(matrixFile);
|
||||
readFileMock.mockResolvedValue(contents);
|
||||
|
||||
const settings = Settings.get();
|
||||
|
||||
|
|
|
@ -188,4 +188,5 @@ export const mockEdsmResponses = {
|
|||
|
||||
export const mockSettings = {
|
||||
graphicsConfigXml: '<GraphicsConfig><GUIColour><Default><MatrixRed>1,0,0</MatrixRed><MatrixGreen>0,1,0</MatrixGreen><MatrixBlue>0,0,1</MatrixBlue></Default></GUIColour></GraphicsConfig>',
|
||||
xmlProfileIni: '[constants]\nx150 = 1\ny150 = 0\nz150 = 0\nx151 = 0\ny151 = 1\nz151 = 0\nx152 = 0\ny152 = 0\nz152 = 1\n',
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue