diff --git a/test/e2e/api.test.ts b/test/e2e/api.test.ts index a8eab703..a7ab1651 100644 --- a/test/e2e/api.test.ts +++ b/test/e2e/api.test.ts @@ -1,8 +1,8 @@ import fetch from 'node-fetch'; +import db from '../../src/helpers/mysql'; import proposalInput from '../fixtures/ingestor-payload/proposal.json'; -import { spacesSqlFixtures } from '../fixtures/space'; import proposalsFixtures from '../fixtures/proposal'; -import db from '../../src/helpers/mysql'; +import { spacesSqlFixtures } from '../fixtures/space'; const HOST = `http://localhost:${process.env.PORT || 3003}`; const SPACE_PREFIX = 'e2e-'; @@ -71,7 +71,8 @@ describe('POST /flag', () => { plugins: JSON.stringify(proposal.plugins), choices: JSON.stringify(proposal.choices), scores: JSON.stringify(proposal.scores), - scores_by_strategy: JSON.stringify(proposal.scores_by_strategy) + scores_by_strategy: JSON.stringify(proposal.scores_by_strategy), + vp_value_by_strategy: JSON.stringify(proposal.vp_value_by_strategy || []) })) .map(async proposal => { db.queryAsync('INSERT INTO snapshot_sequencer_test.proposals SET ?', proposal); diff --git a/test/schema.sql b/test/schema.sql index c18a8428..b833ae49 100644 --- a/test/schema.sql +++ b/test/schema.sql @@ -29,15 +29,15 @@ CREATE TABLE spaces ( ); CREATE TABLE proposals ( - id VARCHAR(66) NOT NULL, - ipfs VARCHAR(64) NOT NULL, + id VARCHAR(66) NOT NULL DEFAULT '', + ipfs VARCHAR(64) NOT NULL DEFAULT '', author VARCHAR(100) NOT NULL, created INT(11) NOT NULL, updated INT(11) DEFAULT NULL, space VARCHAR(64) NOT NULL, network VARCHAR(12) NOT NULL, - symbol VARCHAR(16) NOT NULL, - type VARCHAR(24) NOT NULL, + symbol VARCHAR(16) NOT NULL DEFAULT '', + type VARCHAR(24) NOT NULL DEFAULT '', strategies JSON NOT NULL, validation JSON NOT NULL, plugins JSON NOT NULL, @@ -49,17 +49,20 @@ CREATE TABLE proposals ( start INT(11) NOT NULL, end INT(11) NOT NULL, quorum DECIMAL(64,30) NOT NULL, - quorum_type VARCHAR(24) NOT NULL DEFAULT '', + quorum_type VARCHAR(24) DEFAULT '', privacy VARCHAR(24) NOT NULL, snapshot INT(24) NOT NULL, app VARCHAR(24) NOT NULL, scores JSON NOT NULL, scores_by_strategy JSON NOT NULL, - scores_state VARCHAR(24) NOT NULL, + scores_state VARCHAR(24) NOT NULL DEFAULT '', scores_total DECIMAL(64,30) NOT NULL, scores_updated INT(11) NOT NULL, + scores_total_value DECIMAL(64,30) NOT NULL DEFAULT '0.000000000000000000000000000000', + vp_value_by_strategy json NOT NULL, votes INT(12) NOT NULL, flagged INT NOT NULL DEFAULT 0, + cb INT NOT NULL DEFAULT 0, PRIMARY KEY (id), INDEX ipfs (ipfs), INDEX author (author), @@ -73,7 +76,8 @@ CREATE TABLE proposals ( INDEX scores_state (scores_state), INDEX scores_updated (scores_updated), INDEX votes (votes), - INDEX flagged (flagged) + INDEX flagged (flagged), + INDEX cb (cb) ); CREATE TABLE votes (