mirror of
https://github.com/yuto-yuto/node-red-contrib-password-generator.git
synced 2024-11-21 19:06:44 +01:00
temp
This commit is contained in:
parent
cd168a303d
commit
2e1cab23a4
26
.vscode/launch.json
vendored
Normal file
26
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "node",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Mocha Test",
|
||||||
|
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
||||||
|
"sourceMaps": true,
|
||||||
|
"skipFiles": ["<node_internals>/**"],
|
||||||
|
"args": [
|
||||||
|
"-r",
|
||||||
|
"ts-node/register",
|
||||||
|
"--timeout",
|
||||||
|
"999999",
|
||||||
|
"--colors",
|
||||||
|
"${workspaceFolder}/test/**/*_spec.ts"
|
||||||
|
],
|
||||||
|
"internalConsoleOptions": "openOnSessionStart",
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
FROM nodered/node-red
|
FROM nodered/node-red
|
||||||
|
|
||||||
# error without this
|
# error without this
|
||||||
RUN mkdir -p ./password-generator/node_modules/
|
# RUN mkdir -p ./password-generator/node_modules/
|
||||||
|
|
||||||
COPY ../package.json ../package-lock.json ./password-generator/
|
COPY ../package.json ../package-lock.json ./password-generator/
|
||||||
COPY ../dist ./password-generator/dist
|
COPY ../dist ./password-generator/dist
|
||||||
|
@ -2,7 +2,7 @@ version: "3.7"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
nodered:
|
nodered:
|
||||||
image: nodered-update-detector
|
image: nodered-password-generator
|
||||||
ports:
|
ports:
|
||||||
- "1880:1880"
|
- "1880:1880"
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -397,15 +397,15 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"local": false,
|
"local": false,
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"valueChangeDetector": {
|
"passwordGeneratorNode": {
|
||||||
"name": "valueChangeDetector",
|
"name": "passwordGeneratorNode",
|
||||||
"types": [
|
"types": [
|
||||||
"password-generator"
|
"password-generator"
|
||||||
],
|
],
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"local": false,
|
"local": false,
|
||||||
"module": "node-red-contrib-password-generator",
|
"module": "node-red-contrib-password-generator",
|
||||||
"file": "/usr/src/node-red/node_modules/node-red-contrib-password-generator/dist/lib/ValueChangeDetectorNode.js"
|
"file": "/usr/src/node-red/node_modules/node-red-contrib-password-generator/dist/lib/PasswordGeneratorNode.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,13 +397,13 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"local": false,
|
"local": false,
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"valueChangeDetector": {
|
"passwordGeneratorNode": {
|
||||||
"name": "valueChangeDetector",
|
"name": "passwordGeneratorNode",
|
||||||
"types": [],
|
"types": [],
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"local": false,
|
"local": false,
|
||||||
"module": "node-red-contrib-password-generator",
|
"module": "node-red-contrib-password-generator",
|
||||||
"file": "/usr/src/node-red/node_modules/node-red-contrib-password-generator/dist/lib/ValueChangeDetectorNode.js"
|
"file": "/usr/src/node-red/node_modules/node-red-contrib-password-generator/dist/lib/PasswordGeneratorNode123.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
13
package.json
13
package.json
@ -1,24 +1,24 @@
|
|||||||
{
|
{
|
||||||
"name": "node-red-contrib-password-generator",
|
"name": "node-red-contrib-password-generator",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Send message only when the specified key's value changes",
|
"description": "Generate random password",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS",
|
"start": "node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS",
|
||||||
"build": "tsc && cp ./lib/*.html ./dist/lib/",
|
"build": "tsc && cp ./lib/*.html ./dist/lib/",
|
||||||
"build-d": "npm run build && docker build -t nodered-update-detector -f ./Docker/Dockerfile .",
|
"build-d": "npm run build && docker build -t nodered-password-generator -f ./Docker/Dockerfile .",
|
||||||
"clean": "rm -rf ./dist",
|
"clean": "rm -rf ./dist",
|
||||||
"test": "mocha --recursive --require ts-node/register test/*.ts"
|
"test": "mocha --recursive --require ts-node/register test/*.ts"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"node-red",
|
"node-red",
|
||||||
"password-generator",
|
"password-generator",
|
||||||
"update-detector",
|
"rbe",
|
||||||
"rbe"
|
"crypto"
|
||||||
],
|
],
|
||||||
"node-red": {
|
"node-red": {
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"valueChangeDetector": "./dist/lib/ValueChangeDetectorNode.js"
|
"passwordGeneratorNode": "./dist/lib/PasswordGeneratorNode.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"author": "yuto-yuto",
|
"author": "yuto-yuto",
|
||||||
@ -32,14 +32,13 @@
|
|||||||
"@types/sinon": "^9.0.5",
|
"@types/sinon": "^9.0.5",
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"mocha": "^8.1.3",
|
"mocha": "^8.1.3",
|
||||||
|
"node-red": "^1.3.5",
|
||||||
"node-red-node-test-helper": "^0.2.6",
|
"node-red-node-test-helper": "^0.2.6",
|
||||||
"sinon": "^9.0.3",
|
"sinon": "^9.0.3",
|
||||||
"ts-node": "^8.10.2",
|
"ts-node": "^8.10.2",
|
||||||
"typescript": "^3.9.7"
|
"typescript": "^3.9.7"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-deep-equal": "^3.1.3",
|
|
||||||
"node-red": "^1.3.5",
|
|
||||||
"yutolity": "^1.1.1"
|
"yutolity": "^1.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,22 @@
|
|||||||
import "mocha";
|
import "mocha";
|
||||||
|
import * as crypto from "crypto";
|
||||||
import { expect } from "chai";
|
import { expect } from "chai";
|
||||||
|
import * as sinon from "sinon";
|
||||||
import { generatePassword } from "../lib/PasswordGenerator";
|
import { generatePassword } from "../lib/PasswordGenerator";
|
||||||
|
|
||||||
describe("PasswordGenerator", () => {
|
describe("PasswordGenerator", () => {
|
||||||
it("should return true for the first time", async () => {
|
it("should return true for the first time", async () => {
|
||||||
const result = await generatePassword(10);
|
const result = await generatePassword(10);
|
||||||
console.log(`before: "${result}"`)
|
|
||||||
expect(result).to.lengthOf(10);
|
expect(result).to.lengthOf(10);
|
||||||
});
|
});
|
||||||
|
// it.only("should return true for the first time", async () => {
|
||||||
|
// const testData = Buffer.from([31, 32, 126, 127]);
|
||||||
|
// sinon.stub(crypto, "randomBytes")
|
||||||
|
// .callsFake((size: number, cb: (err: Error | null, buf: Buffer) => void) => {
|
||||||
|
// console.log("HEY")
|
||||||
|
// cb(null, testData);
|
||||||
|
// });
|
||||||
|
// const result = await generatePassword(10);
|
||||||
|
// expect(result).to.equal(" ~");
|
||||||
|
// });
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user