Add Third Way coalition

pull/15/head
Michał Górny 2023-08-21 21:53:36 +02:00
rodzic dd1c9c56a0
commit 410edf75a0
6 zmienionych plików z 29 dodań i 25 usunięć

Wyświetl plik

@ -1,2 +1,14 @@
# sejm-calculator
Simulator for the Polish Sejm election
Main libraries used:
* [Chartist](https://github.com/chartist-js/chartist)
* [Babel](https://github.com/babel/babel)
* [PostCSS](https://github.com/postcss/postcss)
* [Pug](https://github.com/pugjs/pug)
* [TypeScript](https://github.com/microsoft/TypeScript)
* [ESLint](https://github.com/eslint/eslint)
* [Stylelint](https://github.com/stylelint/stylelint)
* [Webpack 5](https://github.com/webpack/webpack)
* [Jest](https://github.com/jestjs/jest)
* [DOM Testing Library](https://github.com/testing-library/dom-testing-library)

Wyświetl plik

@ -35,11 +35,11 @@ export const committees: Committee[] = [
pastSupportEquivalence: [['lewica', 1]],
},
{
id: 'psl',
name: 'PSL – Koalicja Polska',
shortName: 'PSL',
threshold: 5,
pastSupportEquivalence: [['psl', 1]],
id: 'td',
name: 'Trzecia Droga',
shortName: 'TD',
threshold: 8,
pastSupportEquivalence: [['psl', 0.48], ['lewica', 0.23], ['konfederacja', 0.17], ['ko', 0.15], ['pis', 0.03]],
},
{
id: 'konfederacja',
@ -48,13 +48,6 @@ export const committees: Committee[] = [
threshold: 5,
pastSupportEquivalence: [['konfederacja', 1]],
},
{
id: 'pl2050',
name: 'Polska 2050',
shortName: 'PL2050',
threshold: 5,
pastSupportEquivalence: [['psl', 0.24], ['lewica', 0.23], ['konfederacja', 0.17], ['ko', 0.15], ['pis', 0.03]],
},
{
id: 'mn',
name: 'Mniejszość Niemiecka',

Wyświetl plik

@ -164,18 +164,14 @@ h2 {
stroke: #d44;
}
.psl {
stroke: #2ed397;
.td {
stroke: #8bd32e;
}
.konfederacja {
stroke: #655;
}
.pl2050 {
stroke: #f9c013;
}
.mn {
stroke: #aaa;
}

Wyświetl plik

@ -18,6 +18,8 @@ ol.updates
2020-10-28: dodano partię polityczną Polska 2050; jej prognozowane poparcie w okręgach jest
liczone na podstawie deklaracji wyborców Szymona Hołowni przedstawionych w artykule
#[a(href='https://biqdata.wyborcza.pl/biqdata/7,159116,26083709,analiza-przeplywow-wyborcow-za-duda-tylko-pis-lewicowcy-nie.html') #[i Analiza przepływów wyborców]] z 29 czerwca 2020 roku.
li.
2023-08-21: dodano koalicyjny komitet wyborczy Trzecia Droga (Polska 2050 + PSL – Koalicja Polska).
form#support-form

Wyświetl plik

@ -1,22 +1,22 @@
import calculateMandates from '../src/mandates';
test('calculates correct results (1)', () => {
const support = [43.59, 27.4, 12.56, 8.55, 6.81, 0];
const support = [43.59, 27.4, 12.56, 8.55, 6.81];
const mandates = calculateMandates(support);
expect(mandates).toEqual([235, 134, 49, 30, 11, 0, 1]);
expect(mandates).toEqual([237, 133, 48, 31, 10, 1]);
});
test('calculates correct results (2)', () => {
const support = [30, 25, 10, 8, 6, 12];
const support = [30, 25, 10, 20, 6];
const mandates = calculateMandates(support);
expect(mandates).toEqual([182, 133, 40, 34, 12, 58, 1]);
expect(mandates).toEqual([176, 131, 39, 104, 9, 1]);
});
test('calculates correct results (3)', () => {
const support = [39.7, 42.4, 0, 0, 7.2, 0];
const support = [39.7, 42.4, 0, 0, 7.2];
const mandates = calculateMandates(support);
expect(mandates).toEqual([225, 216, 0, 0, 18, 0, 1]);
expect(mandates).toEqual([225, 216, 0, 0, 18, 1]);
});

Wyświetl plik

@ -1,6 +1,7 @@
import {screen} from '@testing-library/dom';
import '@testing-library/jest-dom';
import {generateTable} from '../src/display';
import {committees} from '../src/data';
import html from '../src/templates/content.pug';
beforeEach(() => {
@ -9,7 +10,7 @@ beforeEach(() => {
});
test('display number inputs for electoral data', () => {
const numberOfCommitees = 6;
const numberOfCommitees = committees.length - 1;
const numberInputs = screen.getAllByRole('spinbutton');
expect(numberInputs).toHaveLength(numberOfCommitees);