|
1 | | -const{ getPackageJson}=require("./utils"); |
| 1 | +const{ getPackageJson, isModuleInstalled, doesNotThrow}=require("./utils"); |
2 | 2 | constassert=require("assert"); |
3 | 3 |
|
4 | 4 | describe("package.json",()=>{ |
@@ -54,4 +54,21 @@ describe("package.json", () => { |
54 | 54 | 'should have a "version" value that is a string' |
55 | 55 | ); |
56 | 56 | }); |
| 57 | +// 2.1 |
| 58 | +it('should have "dependencies"',()=>{ |
| 59 | +assert.ok(json.dependencies,'"dependencies" is missing'); |
| 60 | +assert.equal( |
| 61 | +typeofjson.dependencies, |
| 62 | +"object", |
| 63 | +'should have a "dependencies" value that is an object' |
| 64 | +); |
| 65 | +}); |
| 66 | +it('should have installed "moment"',async()=>{ |
| 67 | +assert.ok( |
| 68 | +awaitdoesNotThrow( |
| 69 | +()=>isModuleInstalled({name:"moment",type:"dependency"}), |
| 70 | +'"moment" not installed' |
| 71 | +) |
| 72 | +); |
| 73 | +}); |
57 | 74 | }); |