Converted mocha unit tests to run using mocha-webpack (mochapack) package

This commit is contained in:
danielyxie
2019-05-09 19:03:13 -07:00
parent cdb5dfec62
commit ece246b391
16 changed files with 2120 additions and 6955 deletions

View File

@@ -0,0 +1,11 @@
// TODO Importing NetscriptFunctions breaks the mochapack build
// import { NetscriptFunctions } from "../../src/NetscriptFunctions";
import { expect } from "chai";
console.log("Beginning Netscript Dynamic RAM Calculation/Generation Tests");
describe("Netscript Static RAM Calculation/Generation Tests", function() {
it("should run", function() {
expect(1).to.equal(1);
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,5 @@
# Unit Tests
This directory contains unit tests for Bitburner.
Unit tests use Mocha/Chai and are run through the browser. The Mocha/Chai
packages are sourced directly in HTML.
Unit tests use Mocha/Chai and are run using mochapack (mocha-webpack fork).
Run the test command with `npm run test`

View File

@@ -1,8 +1,7 @@
import { CONSTANTS } from "../src/Constants";
import { Order } from "../src/StockMarket/Order";
//import { processOrders } from "../src/StockMarket/OrderProcessing";
// import { processOrders } from "../src/StockMarket/OrderProcessing";
import { Stock } from "../src/StockMarket/Stock";
/*
import {
deleteStockMarket,
initStockMarket,
@@ -11,7 +10,6 @@ import {
StockMarket,
SymbolToStockMap,
} from "../src/StockMarket/StockMarket";
*/
import {
calculateIncreasingPriceMovement,
calculateDecreasingPriceMovement,
@@ -24,8 +22,9 @@ import {
import { OrderTypes } from "../src/StockMarket/data/OrderTypes"
import { PositionTypes } from "../src/StockMarket/data/PositionTypes";
const assert = chai.assert;
const expect = chai.expect;
//const assert = chai.assert;
//const expect = chai.expect;
import { expect } from "chai";
console.log("Beginning Stock Market Tests");

View File

@@ -1,5 +1,5 @@
<html>
<!-- From https://medium.com/dailyjs/running-mocha-tests-as-native-es6-modules-in-a-browser-882373f2ecb0 -->
<!-- NOT CURRENTLY USED. Used to run mocha in browser -->
<head>
<meta charset="utf-8">
<title>Mocha Tests</title>

View File

@@ -1,2 +1,3 @@
// export * from "./Netscript/DynamicRamCalculationTests";
export * from "./Netscript/StaticRamCalculationTests";
export * from "./StockMarketTests";

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long