Skip to content

Commit 2be585d

Browse files
committed
testing folder structure
1 parent a4d33d6 commit 2be585d

File tree

8 files changed

+319
-279
lines changed

8 files changed

+319
-279
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"chai": "^4.2.0",
2121
"formdata-node": "2.1.0",
2222
"mocha": "^7.0.1",
23+
"nock": "^13.0.4",
2324
"rollup": "^2.22.0",
2425
"rollup-plugin-babel": "^4.4.0",
2526
"rollup-plugin-terser": "^6.1.0",
@@ -28,7 +29,7 @@
2829
"scripts": {
2930
"dev": "rollup -c -w",
3031
"build": "rm -rf dist*;rollup -c",
31-
"test": "yarn install && export NODE_ENV=test && ./node_modules/mocha/bin/mocha --exit -t 40000 test/*.js;ex=$? ; unset NODE_ENV ; exit $ex;",
32+
"test": "yarn install && yarn build && export NODE_ENV=test && ./node_modules/mocha/bin/mocha --exit -t 40000 test/*.js;ex=$? ; unset NODE_ENV ; exit $ex;",
3233
"startSampleApp": "yarn build && cd samples/sample-app/ && yarn install && node index.js"
3334
},
3435
"repository": {

test/data/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports.initializationParams = {
2+
publicKey: "test_public_key",
3+
urlEndpoint: "https://ik.imagekit.io/test_url_endpoint",
4+
authenticationEndpoint: "http://test/auth"
5+
}
File renamed without changes.

test/initialization.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const chai = require("chai");
2+
const expect = chai.expect;
3+
const initializationParams = require("./data").initializationParams
4+
const ImageKit = require(".."); // This will automatically pick main module (cjs bundle) as per package.json
5+
6+
7+
describe("Initialization checks", function () {
8+
var imagekit = new ImageKit(initializationParams);
9+
10+
it('should have options object', function () {
11+
expect(imagekit.options).to.be.an('object');
12+
});
13+
14+
it('should have correctly initialized options object.', function () {
15+
expect(imagekit.options).to.have.property('publicKey').to.be.equal(initializationParams.publicKey);
16+
expect(imagekit.options).to.have.property('urlEndpoint').to.be.equal(initializationParams.urlEndpoint);
17+
expect(imagekit.options).to.have.property('authenticationEndpoint').to.be.equal(initializationParams.authenticationEndpoint);
18+
});
19+
20+
it("should have callable functions 'url' and 'upload'", function () {
21+
expect(imagekit.url).to.exist.and.to.be.a('function');
22+
expect(imagekit.upload).to.exist.and.to.be.a('function');
23+
});
24+
});

test/test.js

Lines changed: 0 additions & 278 deletions
This file was deleted.

0 commit comments

Comments
 (0)