Skip to content

Commit

Permalink
Update main_test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
veture7275 authored Mar 13, 2024
1 parent a46a436 commit 41087de
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions lab2/main_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ const { Application, MailSystem } = require('./main');

// TODO: write your tests here
// Remember to use Stub, Mock, and Spy when necessary
// test("Test MailSystem's write", () => {
// const mailsystem = new MailSystem();
// assert.strictEqual(mailsystem.write("John"), 'Congrats, John!');
// });
// test("Test MailSystem's send",()=>{
// //test('should send mail successfully', () => {
// const mailsystem = new MailSystem();
// const name = 'John';
// Math.random = () => 0.7;
// const result = mailsystem.send(name,mailsystem.write(name));
// assert.strictEqual(result,true);
// Math.random = originalMathRandom;

// Math.random = () => 0.3;
// const result_ = mailsystem.send(name,mailsystem.write(name));
// assert.strictEqual(result_,false);
// });
test("Test MailSystem's write", () => {
const mailsystem = new MailSystem();
assert.strictEqual(mailsystem.write("John"), 'Congrats, John!');
});
test("Test MailSystem's send",()=>{
//test('should send mail successfully', () => {
const mailsystem = new MailSystem();
const name = 'John';
Math.random = () => 0.7;
const result = mailsystem.send(name,mailsystem.write(name));
assert.strictEqual(result,true);
Math.random = originalMathRandom;

Math.random = () => 0.3;
const result_ = mailsystem.send(name,mailsystem.write(name));
assert.strictEqual(result_,false);
});

const data = 'John\nJane\nDoe';

Expand Down

0 comments on commit 41087de

Please sign in to comment.