2019-05-11 21:24:39 +02:00
|
|
|
/**
|
|
|
|
* DefangIP tests.
|
|
|
|
*
|
|
|
|
* @author h345983745
|
|
|
|
*
|
2019-06-29 02:12:50 +02:00
|
|
|
* @copyright Crown Copyright 2019
|
2019-05-11 21:24:39 +02:00
|
|
|
* @license Apache-2.0
|
|
|
|
*/
|
2019-08-13 17:45:53 +02:00
|
|
|
import TestRegister from "../../lib/TestRegister.mjs";
|
2019-05-11 21:24:39 +02:00
|
|
|
|
|
|
|
TestRegister.addTests([
|
|
|
|
{
|
|
|
|
name: "Defang IP: Valid IPV4",
|
|
|
|
input: "192.168.1.1",
|
|
|
|
expectedOutput: "192[.]168[.]1[.]1",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
2019-08-13 17:45:53 +02:00
|
|
|
op: "Defang IP Addresses",
|
2019-06-29 02:12:50 +02:00
|
|
|
args: [],
|
2019-05-11 21:24:39 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
}, {
|
|
|
|
name: "Defang IP: Valid IPV6",
|
|
|
|
input: "2001:0db8:85a3:0000:0000:8a2e:0370:7343",
|
|
|
|
expectedOutput: "2001[:]0db8[:]85a3[:]0000[:]0000[:]8a2e[:]0370[:]7343",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
2019-08-13 17:45:53 +02:00
|
|
|
op: "Defang IP Addresses",
|
2019-06-29 02:12:50 +02:00
|
|
|
args: [],
|
2019-05-11 21:24:39 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
}, {
|
|
|
|
name: "Defang IP: Valid IPV6 Shorthand",
|
|
|
|
input: "2001:db8:3c4d:15::1a2f:1a2b",
|
|
|
|
expectedOutput: "2001[:]db8[:]3c4d[:]15[:][:]1a2f[:]1a2b",
|
|
|
|
recipeConfig: [
|
|
|
|
{
|
2019-08-13 17:45:53 +02:00
|
|
|
op: "Defang IP Addresses",
|
2019-06-29 02:12:50 +02:00
|
|
|
args: [],
|
2019-05-11 21:24:39 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
]);
|