Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D authored and TheLastCicada committed Sep 6, 2023
1 parent 8385796 commit d1d70f5
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 245 deletions.
2 changes: 1 addition & 1 deletion tests/resources/projects.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as testFixtures from '../test-fixtures';
import sinon from 'sinon';
import datalayer from '../../src/datalayer';
const { expect } = chai;
import newProject from '../test-data/new-project.json';
import newProject from '../test-data/new-project.js';
import supertest from 'supertest';
import app from '../../src/server';
import { Organization } from '../../src/models/organizations/index.js';
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/staging.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import app from '../../src/server';
import supertest from 'supertest';
import newProject from '../test-data/new-project.json';
import newProject from '../test-data/new-project.js';
import { pullPickListValues } from '../../src/utils/data-loaders';
import { expect } from 'chai';
import { prepareDb } from '../../src/database';
Expand Down
2 changes: 1 addition & 1 deletion tests/resources/units.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import app from '../../src/server';
import * as testFixtures from '../test-fixtures';
import datalayer from '../../src/datalayer';
import { prepareDb } from '../../src/database';
import newUnit from '../test-data/new-unit.json';
import newUnit from '../test-data/new-unit.js';
import { pullPickListValues } from '../../src/utils/data-loaders';
const TEST_WAIT_TIME = datalayer.POLLING_INTERVAL * 2;

Expand Down
83 changes: 83 additions & 0 deletions tests/test-data/new-project.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
export default {
projectId: 'c9d147e2-bc07-4e68-a76d-43424fa8cd4e',
registryOfOrigin: 'Singapore National Registry',
currentRegistry: 'Singapore National Registry',
originProjectId: 'Singapore National Registry',
program: 'Restoration & Conservation',
projectName: 'Sungei Buloh Wetlands Conservation',
projectLink: 'https://www.nature.com/articles/s41467-021-21560-2',
projectDeveloper:
"NParks' National Biodiversity Centre, National Parks Board, Ridgeview Residential College",
sector: 'Transport',
projectType: 'Organic Waste Composting',
projectTags: 'Wetlands, Reforestation, Million trees',
coveredByNDC: 'Inside NDC',
ndcInformation:
'The restoration and conservation project directly aligns to the Singaporean NDC goals to capture 1,000,000 tons of carbon by 2050. This project represents an estimated contribution of 27% towards the NDC.',
projectStatus: 'Registered',
projectStatusDate: '2022-01-31T00:05:45.701Z',
unitMetric: 'tCO2e',
methodology:
'Recovery and utilization of gas from oil fields that would otherwise be flared or vented --- Version 7.0',
methodology2:
'Recovery and utilization of gas from oil fields that would otherwise be flared or vented --- Version 7.0',
validationBody: 'SCS Global Services',
validationDate: '2021-06-01T17:00:45.701Z',
projectLocations: [
{
country: 'Singapore',
inCountryRegion: 'N/A',
geographicIdentifier: '1°26′46″N 103°43′44″E',
},
],
labels: [
{
label: 'Green-e® Climate Standard Endorsement',
labelType: 'Endorsement',
creditingPeriodStartDate: '2021-06-01T00:00:00.701Z',
creditingPeriodEndDate: '2031-05-30T23:59:59.701Z',
validityPeriodStartDate: '2021-01-01T00:08:00.701Z',
validityPeriodEndDate: '2025-12-31T23:59:59.701Z',
unitQuantity: 1200,
labelLink: 'https://www.green-e.org/programs/climate',
},
],
issuances: [
{
startDate: '2021-02-01T00:00:00.701Z',
endDate: '2022-02-01T00:00:00.701Z',
verificationApproach: 'Atmosperic carbon dioxide measurements',
verificationReportDate: '2022-01-01T08:00:00.701Z',
verificationBody: 'NASA CMS',
},
],
coBenefits: [
{
cobenefit:
'Biodiversity through planting a variety of trees that are home to many native Singaporean species',
},
],
relatedProjects: [
{
relatedProjectId: 'A34398',
relationshipType: 'Pasir Ris Park Conservation',
registry: 'Singapore National Registry',
},
],
projectRatings: [
{
ratingType: 'CCQI',
ratingRangeHighest: 'A',
ratingRangeLowest: 'Z',
rating: 'G',
ratingLink: 'https://www.cdp.net/en/cities/cities-scores',
},
],
estimations: [
{
creditingPeriodStart: '2021-06-01T00:00:00.701Z',
creditingPeriodEnd: '2031-05-30T23:59:59.701Z',
unitCount: 27000,
},
],
};
78 changes: 0 additions & 78 deletions tests/test-data/new-project.json

This file was deleted.

42 changes: 42 additions & 0 deletions tests/test-data/new-unit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
export default {
unitOwner: 'f1c54511-865e-4611-976c-7c3c1f704662',
countryJurisdictionOfOwner: 'Netherlands',
projectLocationId: 'lkjw2er1-nj23-1212-532-dsjdx5-k131',
inCountryJurisdictionOfOwner: 'California',
unitBlockStart: 'AXJJFSLGHSHEJ1000',
unitBlockEnd: 'AXJJFSLGHSHEJ1010',
unitCount: 10,
vintageYear: 2016,
unitType: 'Removal - nature',
marketplace: 'California Carbon',
marketplaceLink: 'https://www.californiacarbon.info/',
marketplaceIdentifier: 'CCMT405',
unitTags: 'CC&S, Sequestration, carbon bury',
unitStatus: 'Held',
unitStatusReason: 'N/A',
unitRegistryLink:
'https://www.climateactionreserve.org/about-us/california-climate-action-registry/',
correspondingAdjustmentDeclaration: 'Committed',
correspondingAdjustmentStatus: 'Not Started',
labels: [
{
warehouseProjectId: '11954678-f7a5-47d2-94f8-f4f3138a529c',
label: 'Green-e® Climate COC certification',
labelType: 'Certification',
creditingPeriodStartDate: '2014-01-10T00:05:45.701Z',
creditingPeriodEndDate: '2019-01-09T00:05:45.701Z',
validityPeriodStartDate: '2014-02-01T00:05:45.701Z',
validityPeriodEndDate: '2019-01-31T00:05:45.701Z',
unitQuantity: 7,
labelLink: 'https://www.green-e.org/programs/climate',
},
],
issuance: {
warehouseProjectId: '11954678-f7a5-47d2-94f8-f4f3138a529c',
startDate: '2014-01-01T00:05:45.701Z',
endDate: '2019-01-31T00:05:45.701Z',
verificationApproach: 'CO2 Detection Satelite',
verificationReportDate: '2016-06-15T00:05:45.701Z',
verificationBody: 'Carbon Mapper',
},
};
41 changes: 0 additions & 41 deletions tests/test-data/new-unit.json

This file was deleted.

80 changes: 80 additions & 0 deletions tests/test-data/update-project.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
export default {
projectId: 'c9d147e2-bc07-4e68-a76d-43424fa8cd4e',
program: 'UPDATED',
projectName: 'UPDATED',
currentRegistry: 'Singapore National Registry',
registryOfOrigin: 'Singapore National Registry',
originProjectId: 'Singapore National Registry',
projectLink: 'UPDATED',
projectDeveloper: 'UPDATED',
sector: 'Energy demand',
projectType: 'Organic Waste Composting',
projectTags: 'UPDATED',
coveredByNDC: 'Outside NDC',
ndcInformation: 'UPDATED',
projectStatus: 'Completed',
projectStatusDate: '1970-01-01T00:00:00.001Z',
unitMetric: 'tCO2e',
methodology:
'Decomposition of fluoroform (HFC-23) waste streams --- Version 6.0.0',
methodology2:
'Decomposition of fluoroform (HFC-23) waste streams --- Version 6.0.0',
validationBody: '4K Earth Science Private Limited',
validationDate: '1970-01-01T00:00:00.001Z',
projectLocations: [
{
country: 'Australia',
inCountryRegion: 'UPDATED',
geographicIdentifier: 'UPDATED',
},
],
labels: [
{
label: 'UPDATED',
labelType: 'Certification',
creditingPeriodStartDate: '1970-01-01T00:00:00.001Z',
creditingPeriodEndDate: '1970-01-01T00:00:00.001Z',
validityPeriodStartDate: '1970-01-01T00:00:00.001Z',
validityPeriodEndDate: '1970-01-01T00:00:00.001Z',
unitQuantity: 7,
labelLink: 'UPDATED',
},
],
issuances: [
{
startDate: '1970-01-01T00:00:00.001Z',
endDate: '1971-01-01T00:00:00.001Z',
verificationApproach: 'UPDATED',
verificationReportDate: '1970-01-01T00:00:00.001Z',
verificationBody: 'UPDATED',
},
],
coBenefits: [
{
cobenefit: 'UPDATED',
},
],
relatedProjects: [
{
relatedProjectId: 'UPDATED',
relationshipType: 'UPDATED',
registry: 'UPDATED',
},
],
projectRatings: [
{
ratingType: 'CDP',
ratingRangeHighest: 'AA',
ratingRangeLowest: 'ZZ',
rating: 'GG',
ratingLink: 'UPDATED',
},
],
estimations: [
{
creditingPeriodStart: '1970-01-01T00:00:00.001Z',
creditingPeriodEnd: '1971-01-01T00:00:00.001Z',
unitCount: 10,
},
],
};
Loading

0 comments on commit d1d70f5

Please sign in to comment.