From 611dcb62f4adea7a4a1d1a41d75d9f8eeadfb1a5 Mon Sep 17 00:00:00 2001 From: Hampus Joakim Borgos Date: Mon, 22 Apr 2024 10:39:05 +0200 Subject: [PATCH] April opinion --- Data/Polls.csv | 3 +++ polls.test.js | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Data/Polls.csv b/Data/Polls.csv index 58e64bd..f36f0cf 100644 --- a/Data/Polls.csv +++ b/Data/Polls.csv @@ -1,4 +1,7 @@ PublYearMonth,Company,M,L,C,KD,S,V,MP,SD,FI,Uncertain,n,PublDate,collectPeriodFrom,collectPeriodTo,approxPeriod,house +2024-apr,Verian,20.5,3.4,4.2,3.7,34.7,7.7,4.5,19.5,NA,NA,2994,2024-04-11,2024-03-25,2024-04-07,FALSE,Sifo +2024-apr,Demoskop,20.2,2.7,4.0,3.2,35.2,7.6,4.4,20.8,NA,NA,NA,2024-04-11,2024-03-24,2024-04-08,FALSE,Demoskop +2024-mar,Indikator,19.6,3.5,4.5,2.4,34.2,8.0,4.8,21.5,NA,NA,2413,2024-03-28,2024-03-04,2024-03-26,FALSE,Indikator 2024-mar,Ipsos,20,4,4,3,36,9,4,19,NA,NA,NA,2024-03-26,2024-03-12,2024-03-24,FALSE,Ipsos 2024-mar,Novus,19.5,3.1,4.6,3.8,36.2,7.8,4.6,19.1,NA,9.7,2230,2024-03-22,2024-02-19,2024-03-17,FALSE,Novus 2024-mar,Sentio,15.7,4.5,4.9,3.5,34.2,8.9,4.7,21.5,NA,NA,NA,2024-03-19,2024-03-10,2024-03-16,TRUE,Sentio diff --git a/polls.test.js b/polls.test.js index 482bf06..6504a59 100755 --- a/polls.test.js +++ b/polls.test.js @@ -2,7 +2,7 @@ const fs = require('fs') const Papa = require('papaparse') const [header, ...polls] = Papa.parse(fs.readFileSync('Data/Polls.csv', { encoding: 'utf8' })).data.filter((poll) => poll.length > 1) -const newerPolls = polls.slice(0, 100) +const newerPolls = polls.slice(0, 70) const allParties = ['M', 'L', 'C', 'KD', 'S', 'V', 'MP', 'SD', 'FI'] test('Header is correct', () => { @@ -59,8 +59,8 @@ test('Newer poll trends make sense', () => { expect(parties['L'], `L in (${poll}) has less than 2.0% support`).toBeGreaterThan(1.9) expect(parties['L'], `L in (${poll}) has more than 7.7% support`).toBeLessThan(7.7) - expect(parties['KD'], `KD in (${poll}) has less than 2.6% support`).toBeGreaterThan(2.5) - expect(parties['KD'], `KD in (${poll}) has more than 7.5% support`).toBeLessThan(7.5) + expect(parties['KD'], `KD in (${poll}) has less than 2.3% support`).toBeGreaterThan(2.3) + expect(parties['KD'], `KD in (${poll}) has more than 6.2% support`).toBeLessThan(6.2) expect(parties['C'], `C in (${poll}) has less than 3.2% support`).toBeGreaterThan(3.2) expect(parties['C'], `C in (${poll}) has more than 8.9% support`).toBeLessThan(8.9)