diff --git a/app.ts b/app.ts index 2a97505..ead8ac3 100644 --- a/app.ts +++ b/app.ts @@ -1,6 +1,2 @@ console.log("hello world"); console.log("nice to meet you!!"); -console.log("hello world"); -console.log("nice to meet you!!"); -console.log("hello world"); -console.log("nice to meet you!!"); diff --git a/test/app.test.ts b/test/app.test.ts new file mode 100644 index 0000000..2b031f5 --- /dev/null +++ b/test/app.test.ts @@ -0,0 +1,14 @@ +// Import a testing framework (e.g. Mocha, Jest, etc.) +const assert = require('assert'); +const { execSync } = require('child_process'); + +// Write a test suite for app.ts +describe('app.ts', function() { + // Write a test case that checks that app.ts prints "hello world" and "nice to meet you!!" to the console + it('should print hello world and nice to meet you!!', function() { + // Run app.ts and capture the output + const output = execSync('node app.ts').toString(); + // Assert that the output matches the expected strings + assert.match(output, /hello world\nnice to meet you!!\n/); + }); +});