mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,573 lines • 825 kB
JSON
{
"type": "File",
"start": 0,
"end": 3601,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 113,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 3601,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 113,
"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": 82,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 30
}
},
"specifiers": [
{
"type": "ImportDefaultSpecifier",
"start": 59,
"end": 65,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 13
}
},
"local": {
"type": "Identifier",
"start": 59,
"end": 65,
"loc": {
"start": {
"line": 4,
"column": 7
},
"end": {
"line": 4,
"column": 13
},
"identifierName": "Seeder"
},
"name": "Seeder"
}
}
],
"source": {
"type": "StringLiteral",
"start": 71,
"end": 81,
"loc": {
"start": {
"line": 4,
"column": 19
},
"end": {
"line": 4,
"column": 29
}
},
"extra": {
"rawValue": "./seeder",
"raw": "'./seeder'"
},
"value": "./seeder"
}
},
{
"type": "ExpressionStatement",
"start": 84,
"end": 209,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 8,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 84,
"end": 208,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 8,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 84,
"end": 88,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"arguments": [
{
"type": "StringLiteral",
"start": 89,
"end": 154,
"loc": {
"start": {
"line": 6,
"column": 5
},
"end": {
"line": 6,
"column": 70
}
},
"extra": {
"rawValue": "should throw error when trying to create new instance of Seeder",
"raw": "'should throw error when trying to create new instance of Seeder'"
},
"value": "should throw error when trying to create new instance of Seeder"
},
{
"type": "ArrowFunctionExpression",
"start": 156,
"end": 207,
"loc": {
"start": {
"line": 6,
"column": 72
},
"end": {
"line": 8,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 156,
"end": 157,
"loc": {
"start": {
"line": 6,
"column": 72
},
"end": {
"line": 6,
"column": 73
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 161,
"end": 207,
"loc": {
"start": {
"line": 6,
"column": 77
},
"end": {
"line": 8,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 165,
"end": 205,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 42
}
},
"expression": {
"type": "CallExpression",
"start": 165,
"end": 204,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 41
}
},
"callee": {
"type": "MemberExpression",
"start": 165,
"end": 173,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 10
}
},
"object": {
"type": "Identifier",
"start": 165,
"end": 166,
"loc": {
"start": {
"line": 7,
"column": 2
},
"end": {
"line": 7,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 167,
"end": 173,
"loc": {
"start": {
"line": 7,
"column": 4
},
"end": {
"line": 7,
"column": 10
},
"identifierName": "throws"
},
"name": "throws"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 174,
"end": 192,
"loc": {
"start": {
"line": 7,
"column": 11
},
"end": {
"line": 7,
"column": 29
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [],
"body": {
"type": "NewExpression",
"start": 180,
"end": 192,
"loc": {
"start": {
"line": 7,
"column": 17
},
"end": {
"line": 7,
"column": 29
}
},
"callee": {
"type": "Identifier",
"start": 184,
"end": 190,
"loc": {
"start": {
"line": 7,
"column": 21
},
"end": {
"line": 7,
"column": 27
},
"identifierName": "Seeder"
},
"name": "Seeder"
},
"arguments": []
}
},
{
"type": "Identifier",
"start": 194,
"end": 203,
"loc": {
"start": {
"line": 7,
"column": 31
},
"end": {
"line": 7,
"column": 40
},
"identifierName": "TypeError"
},
"name": "TypeError"
}
]
}
}
],
"directives": []
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 211,
"end": 360,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 14,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 211,
"end": 359,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 14,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 211,
"end": 215,
"loc": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 10,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"arguments": [
{
"type": "StringLiteral",
"start": 216,
"end": 267,
"loc": {
"start": {
"line": 10,
"column": 5
},
"end": {
"line": 10,
"column": 56
}
},
"extra": {
"rawValue": "should throw error if not implementing run method",
"raw": "'should throw error if not implementing run method'"
},
"value": "should throw error if not implementing run method"
},
{
"type": "ArrowFunctionExpression",
"start": 269,
"end": 358,
"loc": {
"start": {
"line": 10,
"column": 58
},
"end": {
"line": 14,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 269,
"end": 270,
"loc": {
"start": {
"line": 10,
"column": 58
},
"end": {
"line": 10,
"column": 59
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 274,
"end": 358,
"loc": {
"start": {
"line": 10,
"column": 63
},
"end": {
"line": 14,
"column": 1
}
},
"body": [
{
"type": "ClassDeclaration",
"start": 278,
"end": 310,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 34
}
},
"id": {
"type": "Identifier",
"start": 284,
"end": 292,
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 16
},
"identifierName": "MySeeder"
},
"name": "MySeeder"
},
"superClass": {
"type": "Identifier",
"start": 301,
"end": 307,
"loc": {
"start": {
"line": 11,
"column": 25
},
"end": {
"line": 11,
"column": 31
},
"identifierName": "Seeder"
},
"name": "Seeder"
},
"body": {
"type": "ClassBody",
"start": 308,
"end": 310,
"loc": {
"start": {
"line": 11,
"column": 32
},
"end": {
"line": 11,
"column": 34
}
},
"body": []
}
},
{
"type": "ExpressionStatement",
"start": 314,
"end": 356,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 44
}
},
"expression": {
"type": "CallExpression",
"start": 314,
"end": 355,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 43
}
},
"callee": {
"type": "MemberExpression",
"start": 314,
"end": 322,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 10
}
},
"object": {
"type": "Identifier",
"start": 314,
"end": 315,
"loc": {
"start": {
"line": 13,
"column": 2
},
"end": {
"line": 13,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 316,
"end": 322,
"loc": {
"start": {
"line": 13,
"column": 4
},
"end": {
"line": 13,
"column": 10
},
"identifierName": "throws"
},
"name": "throws"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 323,
"end": 343,
"loc": {
"start": {
"line": 13,
"column": 11
},
"end": {
"line": 13,
"column": 31
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [],
"body": {
"type": "NewExpression",
"start": 329,
"end": 343,
"loc": {
"start": {
"line": 13,
"column": 17
},
"end": {
"line": 13,
"column": 31
}
},
"callee": {
"type": "Identifier",
"start": 333,
"end": 341,
"loc": {
"start": {
"line": 13,
"column": 21
},
"end": {
"line": 13,
"column": 29
},
"identifierName": "MySeeder"
},
"name": "MySeeder"
},
"arguments": []
}
},
{
"type": "Identifier",
"start": 345,
"end": 354,
"loc": {
"start": {
"line": 13,
"column": 33
},
"end": {
"line": 13,
"column": 42
},
"identifierName": "TypeError"
},
"name": "TypeError"
}
]
}
}
],
"directives": []
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 362,
"end": 502,
"loc": {
"start": {
"line": 16,
"column": 0
},
"end": {
"line": 18,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 362,
"end": 501,
"loc": {
"start": {
"line": 16,
"column": 0
},
"end": {
"line": 18,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 362,
"end": 366,
"loc": {
"start": {
"line": 16,
"column": 0
},
"end": {
"line": 16,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"arguments": [
{
"type": "StringLiteral",
"start": 367,
"end": 420,
"loc": {
"start": {
"line": 16,
"column": 5
},
"end": {
"line": 16,
"column": 58
}
},
"extra": {
"rawValue": "should throw error when running the base run method",
"raw": "'should throw error when running the base run method'"
},
"value": "should throw error when running the base run method"
},
{
"type": "ArrowFunctionExpression",
"start": 422,
"end": 500,
"loc": {
"start": {
"line": 16,
"column": 60
},
"end": {
"line": 18,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": true,
"params": [
{
"type": "Identifier",
"start": 428,
"end": 429,
"loc": {
"start": {
"line": 16,
"column": 66
},
"end": {
"line": 16,
"column": 67
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 433,
"end": 500,
"loc": {
"start": {
"line": 16,
"column": 71
},
"end": {
"line": 18,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 437,
"end": 498,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 63
}
},
"expression": {
"type": "AwaitExpression",
"start": 437,
"end": 497,
"loc": {
"start": {
"line": 17,
"column": 2
},
"end": {
"line": 17,
"column": 62
}
},
"argument": {
"type": "CallExpression",
"start": 443,
"end": 497,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 62
}
},
"callee": {
"type": "MemberExpression",
"start": 443,
"end": 456,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 21
}
},
"object": {
"type": "Identifier",
"start": 443,
"end": 444,
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 9
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 445,
"end": 456,
"loc": {
"start": {
"line": 17,
"column": 10
},
"end": {
"line": 17,
"column": 21
},
"identifierName": "throwsAsync"
},
"name": "throwsAsync"
},
"computed": false
},
"arguments": [
{
"type": "ArrowFunctionExpression",
"start": 457,
"end": 485,
"loc": {
"start": {
"line": 17,
"column": 22
},
"end": {
"line": 17,
"column": 50
}
},
"id": null,
"generator": false,
"expression": true,
"async": false,
"params": [],
"body": {
"type": "CallExpression",
"start": 463,
"end": 485,
"loc": {
"start": {
"line": 17,
"column": 28
},
"end": {
"line": 17,
"column": 50
}
},
"callee": {
"type": "MemberExpression",
"start": 463,
"end": 483,
"loc": {
"start": {
"line": 17,
"column": 28
},
"end": {
"line": 17,
"column": 48
}
},
"object": {
"type": "MemberExpression",
"start": 463,
"end": 479,
"loc": {
"start": {
"line": 17,
"column": 28
},
"end": {
"line": 17,
"column": 44
}
},
"object": {
"type": "Identifier",
"start": 463,
"end": 469,
"loc": {
"start": {
"line": 17,
"column": 28
},
"end": {
"line": 17,
"column": 34
},
"identifierName": "Seeder"
},
"name": "Seeder"
},
"property": {
"type": "Identifier",
"start": 470,
"end": 479,
"loc": {
"start": {
"line": 17,
"column": 35
},
"end": {
"line": 17,
"column": 44
},
"identifierName": "prototype"
},
"name": "prototype"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 480,
"end": 483,
"loc": {
"start": {
"line": 17,
"column": 45
},
"end": {
"line": 17,
"column": 48
},
"identifierName": "run"
},
"name": "run"
},
"computed": false
},
"arguments": []
}
},
{
"type": "Identifier",
"start": 487,
"end": 496,
"loc": {
"start": {
"line": 17,
"column": 52
},
"end": {
"line": 17,
"column": 61
},
"identifierName": "TypeError"
},
"name": "TypeError"
}
]
}
}
}
],
"directives": []
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 504,
"end": 617,
"loc": {
"start": {
"line": 20,
"column": 0
},
"end": {
"line": 22,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 504,
"end": 616,
"loc": {
"start": {
"line": 20,
"column": 0
},
"end": {
"line": 22,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 504,
"end": 508,
"loc": {
"start": {
"line": 20,
"column": 0
},
"end": {
"line": 20,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"arguments": [
{
"type": "StringLiteral",
"start": 509,
"end": 553,
"loc": {
"start": {
"line": 20,
"column": 5
},
"end": {
"line": 20,
"column": 49
}
},
"extra": {
"rawValue": "async shouldRun method need to return true",
"raw": "'async shouldRun method need to return true'"
},
"value": "async shouldRun method need to return true"
},
{
"type": "ArrowFunctionExpression",
"start": 555,
"end": 615,
"loc": {
"start": {
"line": 20,
"column": 51
},
"end": {
"line": 22,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": true,
"params": [
{
"type": "Identifier",
"start": 561,
"end": 562,
"loc": {
"start": {
"line": 20,
"column": 57
},
"end": {
"line": 20,
"column": 58
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 566,
"end": 615,
"loc": {
"start": {
"line": 20,
"column": 62
},
"end": {
"line": 22,
"column": 1
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 570,
"end": 613,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 45
}
},
"expression": {
"type": "CallExpression",
"start": 570,
"end": 612,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 44
}
},
"callee": {
"type": "MemberExpression",
"start": 570,
"end": 576,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 8
}
},
"object": {
"type": "Identifier",
"start": 570,
"end": 571,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 572,
"end": 576,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 8
},
"identifierName": "true"
},
"name": "true"
},
"computed": false
},
"arguments": [
{
"type": "AwaitExpression",
"start": 577,
"end": 611,
"loc": {
"start": {
"line": 21,
"column": 9
},
"end": {
"line": 21,
"column": 43
}
},
"argument": {
"type": "CallExpression",
"start": 583,
"end": 611,
"loc": {
"start": {
"line": 21,
"column": 15
},
"end": {
"line": 21,
"column": 43
}
},
"callee": {
"type": "MemberExpression",
"start": 583,
"end": 609,
"loc": {
"start": {
"line": 21,
"column": 15
},
"end": {
"line": 21,
"column": 41
}
},
"object": {
"type": "MemberExpression",
"start": 583,
"end": 599,
"loc": {
"start": {
"line": 21,
"column": 15
},
"end": {
"line": 21,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 583,
"end": 589,
"loc": {
"start": {
"line": 21,
"column": 15
},
"end": {
"line": 21,
"column": 21
},
"identifierName": "Seeder"
},
"name": "Seeder"
},
"property": {
"type": "Identifier",
"start": 590,
"end": 599,
"loc": {
"start": {
"line": 21,
"column": 22
},
"end": {
"line": 21,
"column": 31
},
"identifierName": "prototype"
},
"name": "prototype"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 600,
"end": 609,
"loc": {
"start": {
"line": 21,
"column": 32
},
"end": {
"line": 21,
"column": 41
},
"identifierName": "shouldRun"
},
"name": "shouldRun"
},
"computed": false
},
"arguments": []
}
}
]
}
}
],
"directives": []
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 619,
"end": 732,
"loc": {
"start": {
"line": 24,
"column": 0
},
"end": {
"line": 27,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 619,
"end": 731,
"loc": {
"start": {
"line": 24,
"column": 0
},
"end": {
"line": 27,
"column": 2
}
},
"callee": {
"type": "Identifier",
"start": 619,
"end": 623,
"loc": {
"start": {
"line": 24,
"column": 0
},
"