Skip to content

Commit

Permalink
fixed wafer map component test warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
munteannatan committed Jan 25, 2024
1 parent b5411fa commit 7dc89ea
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,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);
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.fillStyle
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});

Expand Down Expand Up @@ -91,9 +95,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 +142,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 +189,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,18 +236,16 @@ 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)
);
});
});
});
Expand Down Expand Up @@ -284,9 +291,13 @@ describe('Wafermap Prerendering module', () => {
});

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

Expand Down Expand Up @@ -331,9 +342,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 = Array(18).fill(emptyDieColor);
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.fillStyle
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});

Expand Down Expand Up @@ -372,20 +387,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 +433,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)
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,26 @@ describe('Wafermap Prerendering module', () => {

it('should have die positions offset from margins', () => {
const waferMapDies = getWaferMapDies();
const expectedValues = waferMapDies.map(die => {
return {
x: die.x + margin.right,
y: die.y + margin.top
};
});
for (let i = 0; i < waferMapDies.length; i += 1) {
expect(prerenderingModule.diesRenderInfo[i]!.x).toEqual(
expectedValues[i]!.x
);
expect(prerenderingModule.diesRenderInfo[i]!.y).toEqual(
expectedValues[i]!.y
);
}

let expectedValues = waferMapDies.map(
waferMapDie => waferMapDie.x + margin.right
);
let actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.x
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);

expectedValues = waferMapDies.map(
waferMapDie => waferMapDie.y + margin.top
);
actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.y
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});

Expand Down Expand Up @@ -101,16 +107,15 @@ describe('Wafermap Prerendering module', () => {

it('should have die horizontal position scaled', () => {
const waferMapDies = getWaferMapDies();
const expectedValues = waferMapDies.map(x => {
return {
x: x.x * 10
};
});
for (let i = 0; i < waferMapDies.length; i += 1) {
expect(prerenderingModule.diesRenderInfo[i]!.x).toEqual(
expectedValues[i]!.x
);
}
const expectedValues = waferMapDies.map(
waferMapDie => waferMapDie.x * 10
);
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.x
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});

Expand Down Expand Up @@ -151,16 +156,15 @@ describe('Wafermap Prerendering module', () => {

it('should have die horizontal position scaled', () => {
const waferMapDies = getWaferMapDies();
const expectedValues = waferMapDies.map(waferMapDie => {
return {
y: waferMapDie.y * 10
};
});
for (let i = 0; i < waferMapDies.length; i += 1) {
expect(prerenderingModule.diesRenderInfo[i]!.y).toEqual(
expectedValues[i]!.y
);
}
const expectedValues = waferMapDies.map(
waferMapDie => waferMapDie.y * 10
);
const actualValues = prerenderingModule.diesRenderInfo.map(
dieRenderInfo => dieRenderInfo.y
);
expect(actualValues).toEqual(
jasmine.arrayWithExactContents(expectedValues)
);
});
});
});

0 comments on commit 7dc89ea

Please sign in to comment.