Skip to content

Commit

Permalink
Implement Testing.
Browse files Browse the repository at this point in the history
Fixes #120

Signed-off-by: Gnanakeethan Balasubramaniam <[email protected]>
  • Loading branch information
gnanakeethan committed Sep 4, 2023
1 parent 461e0e4 commit da196bc
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/lib/sci-o/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {describe, expect, jest, test} from '@jest/globals';
import {SciOModel} from './index';
jest.setTimeout(30000);

describe('ccf:configure test', () => {
test('initialize and test', async () => {
const model = await new SciOModel().configure('ccf', {});
expect(model).toBeInstanceOf(SciOModel);
await expect(
model.calculate([
{
'grid-ci': 200.0,
energy: 100.0,
},
])
).resolves.toStrictEqual([
{
'grid-ci': 200.0,
energy: 100.0,
'operational-emissions': 100.0 * 200.0,
},
]);
await expect(
model.calculate([
{
'grid-ci': 212.1,
energy: 100.0,
},
])
).resolves.toStrictEqual([
{
'grid-ci': 212.1,
energy: 100.0,
'operational-emissions': 100.0 * 212.1,
},
]);
});
});

0 comments on commit da196bc

Please sign in to comment.