mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,625 lines (1,624 loc) • 1.58 MB
JSON
{
"type": "File",
"start": 0,
"end": 6615,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 225,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 6615,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 225,
"column": 0
}
},
"sourceType": "module",
"body": [
{
"type": "ImportDeclaration",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 7,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 11
}
},
"local": {
"type": "Identifier",
"start": 7,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 11
},
"identifierName": "test"
},
"name": "test"
}
}
],
"source": {
"type": "StringLiteral",
"start": 17,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 22
}
},
"extra": {
"rawValue": "ava",
"raw": "'ava'"
},
"value": "ava"
}
},
{
"type": "ImportDeclaration",
"start": 24,
"end": 50,
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 26
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 31,
"end": 36,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 12
}
},
"local": {
"type": "Identifier",
"start": 31,
"end": 36,
"loc": {
"start": {
"line": 2,
"column": 7
},
"end": {
"line": 2,
"column": 12
},
"identifierName": "sinon"
},
"name": "sinon"
}
}
],
"source": {
"type": "StringLiteral",
"start": 42,
"end": 49,
"loc": {
"start": {
"line": 2,
"column": 18
},
"end": {
"line": 2,
"column": 25
}
},
"extra": {
"rawValue": "sinon",
"raw": "'sinon'"
},
"value": "sinon"
}
},
{
"type": "ImportDeclaration",
"start": 52,
"end": 101,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 49
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 59,
"end": 74,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 22
}
},
"local": {
"type": "Identifier",
"start": 59,
"end": 74,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 22
},
"identifierName": "InstallerLogger"
},
"name": "InstallerLogger"
}
}
],
"source": {
"type": "StringLiteral",
"start": 80,
"end": 100,
"loc": {
"start": {
"line": 4,
"column": 28
},
"end": {
"line": 4,
"column": 48
}
},
"extra": {
"rawValue": "./installer-logger",
"raw": "'./installer-logger'"
},
"value": "./installer-logger"
}
},
{
"type": "VariableDeclaration",
"start": 103,
"end": 172,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 8,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 109,
"end": 171,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 8,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 109,
"end": 127,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 24
},
"identifierName": "createMockedLogger"
},
"name": "createMockedLogger"
},
"init": {
"type": "ArrowFunctionExpression",
"start": 130,
"end": 171,
"loc": {
"start": {
"line": 6,
"column": 27
},
"end": {
"line": 8,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 109,
"end": 127,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 24
},
"identifierName": "createMockedLogger"
},
"name": "createMockedLogger"
},
"generator": false,
"expression": false,
"async": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 136,
"end": 171,
"loc": {
"start": {
"line": 6,
"column": 33
},
"end": {
"line": 8,
"column": 1
}
},
"body": [
{
"type": "ReturnStatement",
"start": 140,
"end": 169,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 31
}
},
"argument": {
"type": "NewExpression",
"start": 147,
"end": 168,
"loc": {
"start": {
"line": 7,
"column": 9
},
"end": {
"line": 7,
"column": 30
}
},
"callee": {
"type": "Identifier",
"start": 151,
"end": 166,
"loc": {
"start": {
"line": 7,
"column": 13
},
"end": {
"line": 7,
"column": 28
},
"identifierName": "InstallerLogger"
},
"name": "InstallerLogger"
},
"arguments": []
}
}
],
"directives": []
}
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 174,
"end": 284,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 13,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 174,
"end": 283,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 13,
"column": 2
}
},
"callee": {
"type": "MemberExpression",
"start": 174,
"end": 189,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 10,
"column": 15
}
},
"object": {
"type": "Identifier",
"start": 174,
"end": 178,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 10,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"property": {
"type": "Identifier",
"start": 179,
"end": 189,
"loc": {
"start": {
"line": 10,
"column": 5
},
"end": {
"line": 10,
"column": 15
},
"identifierName": "beforeEach"
},
"name": "beforeEach"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 190,
"end": 196,
"loc": {
"start": {
"line": 10,
"column": 16
},
"end": {
"line": 10,
"column": 22
}
},
"extra": {
"rawValue": "mock",
"raw": "'mock'"
},
"value": "mock"
},
{
"type": "ArrowFunctionExpression",
"start": 198,
"end": 282,
"loc": {
"start": {
"line": 10,
"column": 24
},
"end": {
"line": 13,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 198,
"end": 199,
"loc": {
"start": {
"line": 10,
"column": 24
},
"end": {
"line": 10,
"column": 25
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 203,
"end": 282,
"loc": {
"start": {
"line": 10,
"column": 29
},
"end": {
"line": 13,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 207,
"end": 243,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 38
}
},
"expression": {
"type": "CallExpression",
"start": 207,
"end": 242,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 37
}
},
"callee": {
"type": "MemberExpression",
"start": 207,
"end": 217,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 12
}
},
"object": {
"type": "Identifier",
"start": 207,
"end": 212,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 7
},
"identifierName": "sinon"
},
"name": "sinon"
},
"property": {
"type": "Identifier",
"start": 213,
"end": 217,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 12
},
"identifierName": "stub"
},
"name": "stub"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 218,
"end": 232,
"loc": {
"start": {
"line": 11,
"column": 13
},
"end": {
"line": 11,
"column": 27
}
},
"object": {
"type": "Identifier",
"start": 218,
"end": 224,
"loc": {
"start": {
"line": 11,
"column": 13
},
"end": {
"line": 11,
"column": 19
},
"identifierName": "global"
},
"name": "global"
},
"property": {
"type": "Identifier",
"start": 225,
"end": 232,
"loc": {
"start": {
"line": 11,
"column": 20
},
"end": {
"line": 11,
"column": 27
},
"identifierName": "console"
},
"name": "console"
},
"computed": false
},
{
"type": "StringLiteral",
"start": 234,
"end": 241,
"loc": {
"start": {
"line": 11,
"column": 29
},
"end": {
"line": 11,
"column": 36
}
},
"extra": {
"rawValue": "error",
"raw": "'error'"
},
"value": "error"
}
]
}
},
{
"type": "ExpressionStatement",
"start": 246,
"end": 280,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 36
}
},
"expression": {
"type": "CallExpression",
"start": 246,
"end": 279,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 35
}
},
"callee": {
"type": "MemberExpression",
"start": 246,
"end": 256,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 12
}
},
"object": {
"type": "Identifier",
"start": 246,
"end": 251,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 7
},
"identifierName": "sinon"
},
"name": "sinon"
},
"property": {
"type": "Identifier",
"start": 252,
"end": 256,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 12
},
"identifierName": "stub"
},
"name": "stub"
},
"computed": false
},
"arguments": [
{
"type": "MemberExpression",
"start": 257,
"end": 271,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 27
}
},
"object": {
"type": "Identifier",
"start": 257,
"end": 263,
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 19
},
"identifierName": "global"
},
"name": "global"
},
"property": {
"type": "Identifier",
"start": 264,
"end": 271,
"loc": {
"start": {
"line": 12,
"column": 20
},
"end": {
"line": 12,
"column": 27
},
"identifierName": "console"
},
"name": "console"
},
"computed": false
},
{
"type": "StringLiteral",
"start": 273,
"end": 278,
"loc": {
"start": {
"line": 12,
"column": 29
},
"end": {
"line": 12,
"column": 34
}
},
"extra": {
"rawValue": "log",
"raw": "'log'"
},
"value": "log"
}
]
}
}
],
"directives": []
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 286,
"end": 394,
"loc": {
"start": {
"line": 15,
"column": 0
},
"end": {
"line": 18,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 286,
"end": 393,
"loc": {
"start": {
"line": 15,
"column": 0
},
"end": {
"line": 18,
"column": 2
}
},
"callee": {
"type": "MemberExpression",
"start": 286,
"end": 307,
"loc": {
"start": {
"line": 15,
"column": 0
},
"end": {
"line": 15,
"column": 21
}
},
"object": {
"type": "MemberExpression",
"start": 286,
"end": 300,
"loc": {
"start": {
"line": 15,
"column": 0
},
"end": {
"line": 15,
"column": 14
}
},
"object": {
"type": "Identifier",
"start": 286,
"end": 290,
"loc": {
"start": {
"line": 15,
"column": 0
},
"end": {
"line": 15,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"property": {
"type": "Identifier",
"start": 291,
"end": 300,
"loc": {
"start": {
"line": 15,
"column": 5
},
"end": {
"line": 15,
"column": 14
},
"identifierName": "afterEach"
},
"name": "afterEach"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 301,
"end": 307,
"loc": {
"start": {
"line": 15,
"column": 15
},
"end": {
"line": 15,
"column": 21
},
"identifierName": "always"
},
"name": "always"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 308,
"end": 316,
"loc": {
"start": {
"line": 15,
"column": 22
},
"end": {
"line": 15,
"column": 30
}
},
"extra": {
"rawValue": "unmock",
"raw": "'unmock'"
},
"value": "unmock"
},
{
"type": "ArrowFunctionExpression",
"start": 318,
"end": 392,
"loc": {
"start": {
"line": 15,
"column": 32
},
"end": {
"line": 18,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 318,
"end": 319,
"loc": {
"start": {
"line": 15,
"column": 32
},
"end": {
"line": 15,
"column": 33
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 323,
"end": 392,
"loc": {
"start": {
"line": 15,
"column": 37
},
"end": {
"line": 18,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 327,
"end": 358,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 33
}
},
"expression": {
"type": "CallExpression",
"start": 327,
"end": 357,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 32
}
},
"callee": {
"type": "MemberExpression",
"start": 327,
"end": 355,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 30
}
},
"object": {
"type": "MemberExpression",
"start": 327,
"end": 347,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 22
}
},
"object": {
"type": "MemberExpression",
"start": 327,
"end": 341,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 16
}
},
"object": {
"type": "Identifier",
"start": 327,
"end": 333,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 16,
"column": 8
},
"identifierName": "global"
},
"name": "global"
},
"property": {
"type": "Identifier",
"start": 334,
"end": 341,
"loc": {
"start": {
"line": 16,
"column": 9
},
"end": {
"line": 16,
"column": 16
},
"identifierName": "console"
},
"name": "console"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 342,
"end": 347,
"loc": {
"start": {
"line": 16,
"column": 17
},
"end": {
"line": 16,
"column": 22
},
"identifierName": "error"
},
"name": "error"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 348,
"end": 355,
"loc": {
"start": {
"line": 16,
"column": 23
},
"end": {
"line": 16,
"column": 30
},
"identifierName": "restore"
},
"name": "restore"
},
"computed": false
},
"arguments": []
}
},
{
"type": "ExpressionStatement",
"start": 361,
"end": 390,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 31
}
},
"expression": {
"type": "CallExpression",
"start": 361,
"end": 389,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 30
}
},
"callee": {
"type": "MemberExpression",
"start": 361,
"end": 387,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 28
}
},
"object": {
"type": "MemberExpression",
"start": 361,
"end": 379,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 20
}
},
"object": {
"type": "MemberExpression",
"start": 361,
"end": 375,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 16
}
},
"object": {
"type": "Identifier",
"start": 361,
"end": 367,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 8
},
"identifierName": "global"
},
"name": "global"
},
"property": {
"type": "Identifier",
"start": 368,
"end": 375,
"loc": {
"start": {
"line": 17,
"column": 9
},
"end": {
"line": 17,
"column": 16
},
"identifierName": "console"
},
"name": "console"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 376,
"end": 379,
"loc": {
"start": {
"line": 17,
"column": 17
},
"end": {
"line": 17,
"column": 20
},
"identifierName": "log"
},
"name": "log"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 380,
"end": 387,
"loc": {
"start": {
"line": 17,
"column": 21
},
"end": {
"line": 17,
"column": 28
},
"identifierName": "restore"
},
"name": "restore"
},
"computed": false
},
"arguments": []
}
}
],
"directives": []
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 396,
"end": 550,
"loc": {
"start": {
"line": 20,
"column": 0
},
"end": {
"line": 24,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 396,
"end": 549,
"loc": {
"start": {
"line": 20,
"column": 0
},
"end": {
"line": 24,
"column": 2
}
},
"callee": {
"type": "MemberExpression",
"start": 396,
"end": 407,
"loc": {
"start": {
"line": 20,
"column": 0
},
"end": {
"line": 20,
"column": 11
}
},
"object": {
"type": "Identifier",
"start": 396,
"end": 400,
"loc": {
"start": {
"line": 20,
"column": 0
},
"end": {
"line": 20,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"property": {
"type": "Identifier",
"start": 401,
"end": 407,
"loc": {
"start": {
"line": 20,
"column": 5
},
"end": {
"line": 20,
"column": 11
},
"identifierName": "serial"
},
"name": "serial"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 408,
"end": 451,
"loc": {
"start": {
"line": 20,
"column": 12
},
"end": {
"line": 20,
"column": 55
}
},
"extra": {
"rawValue": "Should create a installer-logger instance",
"raw": "'Should create a installer-logger instance'"
},
"value": "Should create a installer-logger instance"
},
{
"type": "ArrowFunctionExpression",
"start": 453,
"end": 548,
"loc": {
"start": {
"line": 20,
"column": 57
},
"end": {
"line": 24,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 453,
"end": 454,
"loc": {
"start": {
"line": 20,
"column": 57
},
"end": {
"line": 20,
"column": 58
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 458,
"end": 548,
"loc": {
"start": {
"line": 20,
"column": 62
},
"end": {
"line": 24,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 462,
"end": 499,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 39
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 468,
"end": 498,
"loc": {
"start": {
"line": 21,
"column": 8
},
"end": {
"line": 21,
"column": 38
}
},
"id": {
"type": "Identifier",
"start": 468,
"end": 474,
"loc": {
"start": {
"line": 21,
"column": 8
},
"end": {
"line": 21,
"column": 14
},
"identifierName": "logger"
},
"name": "logger"
},
"init": {
"type": "NewExpression",
"start": 477,
"end": 498,
"loc": {
"start": {
"line": 21,
"column": 17
},
"end": {
"line": 21,
"column": 38
}
},
"callee": {
"type": "Identifier",
"start": 481,
"end": 496,
"loc": {
"start": {
"line": 21,
"column": 21
},
"end": {
"line": 21,
"column": 36
},
"identifierName": "InstallerLogger"
},
"name": "InstallerLogger"
},
"arguments": []
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 503,
"end": 546,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 45
}
},
"expression": {
"type": "CallExpression",
"start": 503,
"end": 545,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 44
}
},
"callee": {
"type": "MemberExpression",
"start": 503,
"end": 507,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 6
}
},
"object": {
"type": "Identifier",
"start": 503,
"end": 504,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 3