Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Wafer Map Component Test warnings #1781

Merged
merged 4 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fixed wafer map component test warnings",
"packageName": "@ni/nimble-components",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
defaultHorizontalScale,
defaultVerticalScale,
getWaferMapDies,
getWaferMapMockPrerendering
getWaferMapMockPrerendering,
getScaleBand
} from './utilities';

describe('Wafermap Prerendering module', () => {
Expand Down Expand Up @@ -50,9 +51,13 @@ describe('Wafermap Prerendering module', () => {
});

it('should have black fill style for all dies', () => {
for (const dieRenderInfo of prerenderingModule.diesRenderInfo) {
expect(dieRenderInfo.fillStyle).toEqual(emptyDieColor);
}
const expectedValues = Array(18).fill(emptyDieColor);
munteannatan marked this conversation as resolved.
Show resolved Hide resolved
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.fillStyle
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});

Expand Down Expand Up @@ -91,9 +96,13 @@ describe('Wafermap Prerendering module', () => {
});

it('should have the same fill style for all dies', () => {
for (const dieRenderInfo of prerenderingModule.diesRenderInfo) {
expect(dieRenderInfo.fillStyle).toEqual('rgba(255,0,0,1)');
}
const expectedValues = Array(18).fill('rgba(255,0,0,1)');
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.fillStyle
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});

Expand Down Expand Up @@ -134,17 +143,14 @@ describe('Wafermap Prerendering module', () => {
it('should have the fill style equally distributed to dies', () => {
const waferMapDies = getWaferMapDies();
const expectedValues = waferMapDies.map(waferMapDie => {
return {
fillStyle: `rgba(${
(+waferMapDie.value - 1) * 15
},0,0,1)`
};
return `rgba(${(+waferMapDie.value - 1) * 15},0,0,1)`;
});
for (let i = 0; i < waferMapDies.length; i += 1) {
expect(
prerenderingModule.diesRenderInfo[i]!.fillStyle
).toEqual(expectedValues[i]!.fillStyle);
}
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.fillStyle
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});
});
Expand Down Expand Up @@ -184,9 +190,13 @@ describe('Wafermap Prerendering module', () => {
});

it('should have the same fill style for all dies', () => {
for (const dieRenderInfo of prerenderingModule.diesRenderInfo) {
expect(dieRenderInfo.fillStyle).toEqual('rgba(255,0,0,1)');
}
const expectedValues = Array(18).fill('rgba(255,0,0,1)');
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.fillStyle
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});

Expand Down Expand Up @@ -227,26 +237,21 @@ describe('Wafermap Prerendering module', () => {
it('should have alternating fill style for the dies', () => {
const waferMapDies = getWaferMapDies();
const expectedValues = waferMapDies.map(waferMapDie => {
const fillStyle = +waferMapDie.value % 2 === 1
return +waferMapDie.value % 2 === 1
? 'rgba(0,0,0,1)'
: 'rgba(255,0,0,1)';
return {
fillStyle
};
});
for (let i = 0; i < waferMapDies.length; i += 1) {
expect(
prerenderingModule.diesRenderInfo[i]!.fillStyle
).toEqual(expectedValues[i]!.fillStyle);
}
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.fillStyle
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});
});

// Test disabled as it currently does not have expect statements
// that run to perform any useful validation
// See: https://github.com/ni/nimble/issues/1746
xdescribe('with non numeric values', () => {
describe('with non numeric values', () => {
const dieDimensions = { width: 10, height: 10 };
const dieLabelsSuffix = '';
const dieLabelsHidden = true;
Expand All @@ -273,8 +278,8 @@ describe('Wafermap Prerendering module', () => {
const dataManagerMock = getDataManagerMock(
dieDimensions,
margin,
defaultHorizontalScale,
defaultVerticalScale
getScaleBand([0, 1], [0, 100]),
getScaleBand([0, 1], [0, 100])
);
prerenderingModule = new Prerendering(
waferMock as WaferMap,
Expand All @@ -284,16 +289,17 @@ describe('Wafermap Prerendering module', () => {
});

it('should have NaN color fill style', () => {
for (const dieRenderInfo of prerenderingModule.diesRenderInfo) {
expect(dieRenderInfo.fillStyle).toEqual(nanDieColor);
}
const expectedValues = [nanDieColor];
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.fillStyle
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});

// Test disabled as it currently does not have expect statements
// that run to perform any useful validation
// See: https://github.com/ni/nimble/issues/1746
xdescribe('with undefined values', () => {
describe('with undefined values', () => {
const dieDimensions = { width: 10, height: 10 };
const dieLabelsSuffix = '';
const dieLabelsHidden = true;
Expand All @@ -320,8 +326,8 @@ describe('Wafermap Prerendering module', () => {
const dataManagerMock = getDataManagerMock(
dieDimensions,
margin,
defaultHorizontalScale,
defaultVerticalScale
getScaleBand([0, 1], [0, 100]),
getScaleBand([0, 1], [0, 100])
);
prerenderingModule = new Prerendering(
waferMock as WaferMap,
Expand All @@ -331,9 +337,13 @@ describe('Wafermap Prerendering module', () => {
});

it('should have empty color fill style', () => {
for (const dieRenderInfo of prerenderingModule.diesRenderInfo) {
expect(dieRenderInfo.fillStyle).toEqual(emptyDieColor);
}
const expectedValues = [emptyDieColor];
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.fillStyle
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});

Expand Down Expand Up @@ -372,20 +382,17 @@ describe('Wafermap Prerendering module', () => {
const waferMapDies = getWaferMapDies();
const expectedValues = waferMapDies.map(waferMapDie => {
if (!waferMapDie.tags) {
return {
fillStyle: 'rgba(255,0,0,0.3)'
};
return 'rgba(255,0,0,0.3)';
}
const opacity = waferMapDie.tags[0] === highlightedTag ? 1 : 0.3;
return {
fillStyle: `rgba(255,0,0,${opacity})`
};
return `rgba(255,0,0,${opacity})`;
});
for (let i = 0; i < waferMapDies.length; i += 1) {
expect(prerenderingModule.diesRenderInfo[i]!.fillStyle).toEqual(
expectedValues[i]!.fillStyle
);
}
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.fillStyle
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});

Expand Down Expand Up @@ -421,9 +428,13 @@ describe('Wafermap Prerendering module', () => {
});

it('should have all dies with full opacity', () => {
for (const dieRenderInfo of prerenderingModule.diesRenderInfo) {
expect(dieRenderInfo.fillStyle).toEqual('rgba(255,0,0,1)');
}
const expectedValues = Array(18).fill('rgba(255,0,0,1)');
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.fillStyle
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ describe('Wafermap Prerendering module', () => {
});

it('should have label suffix for each die', () => {
for (const dieRenderInfo of prerenderingModule.diesRenderInfo) {
expect(dieRenderInfo.text).toContain(dieLabelsSuffix);
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.text
);
expect(actualValues).not.toHaveSize(0);
for (const value of actualValues) {
expect(value).toContain(dieLabelsSuffix);
}
});
});
Expand Down Expand Up @@ -167,9 +171,13 @@ describe('Wafermap Prerendering module', () => {
});

it('should not have full label suffix for each die and end in ellipsis', () => {
for (const dieRenderInfo of prerenderingModule.diesRenderInfo) {
expect(dieRenderInfo.text).not.toContain(dieLabelsSuffix);
expect(dieRenderInfo.text).toContain('…');
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.text
);
expect(actualValues).not.toHaveSize(0);
for (const value of actualValues) {
expect(value).not.toContain(dieLabelsSuffix);
expect(value).toContain('…');
}
});
});
Expand Down Expand Up @@ -207,11 +215,15 @@ describe('Wafermap Prerendering module', () => {

it('should have labels equal with values for each die', () => {
const waferMapDies = getWaferMapDies();
for (let i = 0; i < waferMapDies.length; i += 1) {
expect(prerenderingModule.diesRenderInfo[i]!.text).toEqual(
waferMapDies[i]!.value
);
}
const expectedValues = waferMapDies.map(
waferMapDie => waferMapDie.value
);
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.text
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});

Expand Down Expand Up @@ -248,11 +260,15 @@ describe('Wafermap Prerendering module', () => {

it('should have labels equal with values for each die', () => {
const waferMapNaNDies = getWaferMapDiesAsNaN();
for (let i = 0; i < waferMapNaNDies.length; i += 1) {
expect(prerenderingModule.diesRenderInfo[i]!.text).toEqual(
waferMapNaNDies[i]!.value
);
}
const expectedValues = waferMapNaNDies.map(
waferMapDie => waferMapDie.value
);
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.text
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});

Expand Down Expand Up @@ -292,16 +308,15 @@ describe('Wafermap Prerendering module', () => {
+ 'but limited by the maximum number of characters and a ellipsis',
() => {
const waferMapFloatDies = getWaferMapDiesAsFloats();
const expectedValues = waferMapFloatDies.map(x => {
return {
text: `${x.value.substring(0, maxCharacters)}…`
};
const expectedValues = waferMapFloatDies.map(waferMapDie => {
return `${waferMapDie.value.substring(0, maxCharacters)}…`;
});
for (let i = 0; i < waferMapFloatDies.length; i += 1) {
expect(prerenderingModule.diesRenderInfo[i]!.text).toEqual(
expectedValues[i]!.text
);
}
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.text
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
}
);
});
Expand Down Expand Up @@ -338,9 +353,13 @@ describe('Wafermap Prerendering module', () => {
});

it('should have empty label for each die', () => {
for (const dieRenderInfo of prerenderingModule.diesRenderInfo) {
expect(dieRenderInfo.text).toEqual('');
}
const expectedValues = Array(18).fill('');
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.text
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});
});
Loading
Loading