mongoose-data-seed
Version:
Seed mongodb with data using mongoose models
1,620 lines (1,619 loc) • 261 kB
JSON
{
"type": "File",
"start": 0,
"end": 1223,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 53,
"column": 0
}
},
"program": {
"type": "Program",
"start": 0,
"end": 1223,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 53,
"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": 121,
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 69
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 61,
"end": 72,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 20
}
},
"imported": {
"type": "Identifier",
"start": 61,
"end": 72,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 20
},
"identifierName": "mockImports"
},
"name": "mockImports"
},
"local": {
"type": "Identifier",
"start": 61,
"end": 72,
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 20
},
"identifierName": "mockImports"
},
"name": "mockImports"
}
},
{
"type": "ImportSpecifier",
"start": 74,
"end": 86,
"loc": {
"start": {
"line": 4,
"column": 22
},
"end": {
"line": 4,
"column": 34
}
},
"imported": {
"type": "Identifier",
"start": 74,
"end": 86,
"loc": {
"start": {
"line": 4,
"column": 22
},
"end": {
"line": 4,
"column": 34
},
"identifierName": "resetImports"
},
"name": "resetImports"
},
"local": {
"type": "Identifier",
"start": 74,
"end": 86,
"loc": {
"start": {
"line": 4,
"column": 22
},
"end": {
"line": 4,
"column": 34
},
"identifierName": "resetImports"
},
"name": "resetImports"
}
}
],
"source": {
"type": "StringLiteral",
"start": 94,
"end": 120,
"loc": {
"start": {
"line": 4,
"column": 42
},
"end": {
"line": 4,
"column": 68
}
},
"extra": {
"rawValue": "../../utils/test-helpers",
"raw": "'../../utils/test-helpers'"
},
"value": "../../utils/test-helpers"
}
},
{
"type": "ImportDeclaration",
"start": 123,
"end": 196,
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 6,
"column": 73
}
},
"specifiers": [
{
"type": "ImportSpecifier",
"start": 132,
"end": 142,
"loc": {
"start": {
"line": 6,
"column": 9
},
"end": {
"line": 6,
"column": 19
}
},
"imported": {
"type": "Identifier",
"start": 132,
"end": 142,
"loc": {
"start": {
"line": 6,
"column": 9
},
"end": {
"line": 6,
"column": 19
},
"identifierName": "getOptions"
},
"name": "getOptions"
},
"local": {
"type": "Identifier",
"start": 132,
"end": 142,
"loc": {
"start": {
"line": 6,
"column": 9
},
"end": {
"line": 6,
"column": 19
},
"identifierName": "getOptions"
},
"name": "getOptions"
}
},
{
"type": "ImportSpecifier",
"start": 144,
"end": 176,
"loc": {
"start": {
"line": 6,
"column": 21
},
"end": {
"line": 6,
"column": 53
}
},
"imported": {
"type": "Identifier",
"start": 144,
"end": 157,
"loc": {
"start": {
"line": 6,
"column": 21
},
"end": {
"line": 6,
"column": 34
},
"identifierName": "__RewireAPI__"
},
"name": "__RewireAPI__"
},
"local": {
"type": "Identifier",
"start": 161,
"end": 176,
"loc": {
"start": {
"line": 6,
"column": 38
},
"end": {
"line": 6,
"column": 53
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
}
}
],
"source": {
"type": "StringLiteral",
"start": 184,
"end": 195,
"loc": {
"start": {
"line": 6,
"column": 61
},
"end": {
"line": 6,
"column": 72
}
},
"extra": {
"rawValue": "./options",
"raw": "'./options'"
},
"value": "./options"
}
},
{
"type": "VariableDeclaration",
"start": 198,
"end": 298,
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 13,
"column": 2
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 204,
"end": 297,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 13,
"column": 1
}
},
"id": {
"type": "Identifier",
"start": 204,
"end": 212,
"loc": {
"start": {
"line": 8,
"column": 6
},
"end": {
"line": 8,
"column": 14
},
"identifierName": "helpData"
},
"name": "helpData"
},
"init": {
"type": "ObjectExpression",
"start": 215,
"end": 297,
"loc": {
"start": {
"line": 8,
"column": 17
},
"end": {
"line": 13,
"column": 1
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 219,
"end": 236,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 19
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 219,
"end": 223,
"loc": {
"start": {
"line": 9,
"column": 2
},
"end": {
"line": 9,
"column": 6
},
"identifierName": "argv"
},
"name": "argv"
},
"value": {
"type": "StringLiteral",
"start": 225,
"end": 236,
"loc": {
"start": {
"line": 9,
"column": 8
},
"end": {
"line": 9,
"column": 19
}
},
"extra": {
"rawValue": "some-argv",
"raw": "'some-argv'"
},
"value": "some-argv"
}
},
{
"type": "ObjectProperty",
"start": 240,
"end": 263,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 25
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 240,
"end": 247,
"loc": {
"start": {
"line": 10,
"column": 2
},
"end": {
"line": 10,
"column": 9
},
"identifierName": "seeders"
},
"name": "seeders"
},
"value": {
"type": "StringLiteral",
"start": 249,
"end": 263,
"loc": {
"start": {
"line": 10,
"column": 11
},
"end": {
"line": 10,
"column": 25
}
},
"extra": {
"rawValue": "some-seeders",
"raw": "'some-seeders'"
},
"value": "some-seeders"
}
},
{
"type": "ObjectProperty",
"start": 267,
"end": 279,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 14
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 267,
"end": 273,
"loc": {
"start": {
"line": 11,
"column": 2
},
"end": {
"line": 11,
"column": 8
},
"identifierName": "dropdb"
},
"name": "dropdb"
},
"value": {
"type": "BooleanLiteral",
"start": 275,
"end": 279,
"loc": {
"start": {
"line": 11,
"column": 10
},
"end": {
"line": 11,
"column": 14
}
},
"value": true
}
},
{
"type": "ObjectProperty",
"start": 283,
"end": 294,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 13
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 283,
"end": 287,
"loc": {
"start": {
"line": 12,
"column": 2
},
"end": {
"line": 12,
"column": 6
},
"identifierName": "help"
},
"name": "help"
},
"value": {
"type": "BooleanLiteral",
"start": 289,
"end": 294,
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 13
}
},
"value": false
}
}
]
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 300,
"end": 520,
"loc": {
"start": {
"line": 15,
"column": 0
},
"end": {
"line": 24,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 300,
"end": 519,
"loc": {
"start": {
"line": 15,
"column": 0
},
"end": {
"line": 24,
"column": 2
}
},
"callee": {
"type": "MemberExpression",
"start": 300,
"end": 315,
"loc": {
"start": {
"line": 15,
"column": 0
},
"end": {
"line": 15,
"column": 15
}
},
"object": {
"type": "Identifier",
"start": 300,
"end": 304,
"loc": {
"start": {
"line": 15,
"column": 0
},
"end": {
"line": 15,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"property": {
"type": "Identifier",
"start": 305,
"end": 315,
"loc": {
"start": {
"line": 15,
"column": 5
},
"end": {
"line": 15,
"column": 15
},
"identifierName": "beforeEach"
},
"name": "beforeEach"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 316,
"end": 330,
"loc": {
"start": {
"line": 15,
"column": 16
},
"end": {
"line": 15,
"column": 30
}
},
"extra": {
"rawValue": "mock imports",
"raw": "'mock imports'"
},
"value": "mock imports"
},
{
"type": "ArrowFunctionExpression",
"start": 332,
"end": 518,
"loc": {
"start": {
"line": 15,
"column": 32
},
"end": {
"line": 24,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 332,
"end": 333,
"loc": {
"start": {
"line": 15,
"column": 32
},
"end": {
"line": 15,
"column": 33
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 337,
"end": 518,
"loc": {
"start": {
"line": 15,
"column": 37
},
"end": {
"line": 24,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 341,
"end": 446,
"loc": {
"start": {
"line": 16,
"column": 2
},
"end": {
"line": 19,
"column": 4
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 347,
"end": 445,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 19,
"column": 3
}
},
"id": {
"type": "Identifier",
"start": 347,
"end": 352,
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 13
},
"identifierName": "mocks"
},
"name": "mocks"
},
"init": {
"type": "ObjectExpression",
"start": 355,
"end": 445,
"loc": {
"start": {
"line": 16,
"column": 16
},
"end": {
"line": 19,
"column": 3
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 361,
"end": 405,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 48
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 361,
"end": 378,
"loc": {
"start": {
"line": 17,
"column": 4
},
"end": {
"line": 17,
"column": 21
},
"identifierName": "optionDefinitions"
},
"name": "optionDefinitions"
},
"value": {
"type": "StringLiteral",
"start": 380,
"end": 405,
"loc": {
"start": {
"line": 17,
"column": 23
},
"end": {
"line": 17,
"column": 48
}
},
"extra": {
"rawValue": "some option definitions",
"raw": "'some option definitions'"
},
"value": "some option definitions"
}
},
{
"type": "ObjectProperty",
"start": 411,
"end": 440,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 33
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 411,
"end": 426,
"loc": {
"start": {
"line": 18,
"column": 4
},
"end": {
"line": 18,
"column": 19
},
"identifierName": "commandLineArgs"
},
"name": "commandLineArgs"
},
"value": {
"type": "CallExpression",
"start": 428,
"end": 440,
"loc": {
"start": {
"line": 18,
"column": 21
},
"end": {
"line": 18,
"column": 33
}
},
"callee": {
"type": "MemberExpression",
"start": 428,
"end": 438,
"loc": {
"start": {
"line": 18,
"column": 21
},
"end": {
"line": 18,
"column": 31
}
},
"object": {
"type": "Identifier",
"start": 428,
"end": 433,
"loc": {
"start": {
"line": 18,
"column": 21
},
"end": {
"line": 18,
"column": 26
},
"identifierName": "sinon"
},
"name": "sinon"
},
"property": {
"type": "Identifier",
"start": 434,
"end": 438,
"loc": {
"start": {
"line": 18,
"column": 27
},
"end": {
"line": 18,
"column": 31
},
"identifierName": "stub"
},
"name": "stub"
},
"computed": false
},
"arguments": []
}
}
]
}
}
],
"kind": "const"
},
{
"type": "ExpressionStatement",
"start": 450,
"end": 472,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 24
}
},
"expression": {
"type": "AssignmentExpression",
"start": 450,
"end": 471,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 23
}
},
"operator": "=",
"left": {
"type": "MemberExpression",
"start": 450,
"end": 459,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 11
}
},
"object": {
"type": "Identifier",
"start": 450,
"end": 451,
"loc": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 3
},
"identifierName": "t"
},
"name": "t"
},
"property": {
"type": "Identifier",
"start": 452,
"end": 459,
"loc": {
"start": {
"line": 21,
"column": 4
},
"end": {
"line": 21,
"column": 11
},
"identifierName": "context"
},
"name": "context"
},
"computed": false
},
"right": {
"type": "ObjectExpression",
"start": 462,
"end": 471,
"loc": {
"start": {
"line": 21,
"column": 14
},
"end": {
"line": 21,
"column": 23
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 464,
"end": 469,
"loc": {
"start": {
"line": 21,
"column": 16
},
"end": {
"line": 21,
"column": 21
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 464,
"end": 469,
"loc": {
"start": {
"line": 21,
"column": 16
},
"end": {
"line": 21,
"column": 21
},
"identifierName": "mocks"
},
"name": "mocks"
},
"value": {
"type": "Identifier",
"start": 464,
"end": 469,
"loc": {
"start": {
"line": 21,
"column": 16
},
"end": {
"line": 21,
"column": 21
},
"identifierName": "mocks"
},
"name": "mocks"
},
"extra": {
"shorthand": true
}
}
]
}
}
},
{
"type": "ExpressionStatement",
"start": 476,
"end": 516,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 42
}
},
"expression": {
"type": "CallExpression",
"start": 476,
"end": 515,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 41
}
},
"callee": {
"type": "Identifier",
"start": 476,
"end": 487,
"loc": {
"start": {
"line": 23,
"column": 2
},
"end": {
"line": 23,
"column": 13
},
"identifierName": "mockImports"
},
"name": "mockImports"
},
"arguments": [
{
"type": "ObjectExpression",
"start": 488,
"end": 514,
"loc": {
"start": {
"line": 23,
"column": 14
},
"end": {
"line": 23,
"column": 40
}
},
"properties": [
{
"type": "ObjectProperty",
"start": 490,
"end": 505,
"loc": {
"start": {
"line": 23,
"column": 16
},
"end": {
"line": 23,
"column": 31
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 490,
"end": 505,
"loc": {
"start": {
"line": 23,
"column": 16
},
"end": {
"line": 23,
"column": 31
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
},
"value": {
"type": "Identifier",
"start": 490,
"end": 505,
"loc": {
"start": {
"line": 23,
"column": 16
},
"end": {
"line": 23,
"column": 31
},
"identifierName": "moduleRewireAPI"
},
"name": "moduleRewireAPI"
},
"extra": {
"shorthand": true
}
},
{
"type": "ObjectProperty",
"start": 507,
"end": 512,
"loc": {
"start": {
"line": 23,
"column": 33
},
"end": {
"line": 23,
"column": 38
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 507,
"end": 512,
"loc": {
"start": {
"line": 23,
"column": 33
},
"end": {
"line": 23,
"column": 38
},
"identifierName": "mocks"
},
"name": "mocks"
},
"value": {
"type": "Identifier",
"start": 507,
"end": 512,
"loc": {
"start": {
"line": 23,
"column": 33
},
"end": {
"line": 23,
"column": 38
},
"identifierName": "mocks"
},
"name": "mocks"
},
"extra": {
"shorthand": true
}
}
]
}
]
}
}
],
"directives": []
}
}
]
}
},
{
"type": "ExpressionStatement",
"start": 522,
"end": 667,
"loc": {
"start": {
"line": 26,
"column": 0
},
"end": {
"line": 30,
"column": 3
}
},
"expression": {
"type": "CallExpression",
"start": 522,
"end": 666,
"loc": {
"start": {
"line": 26,
"column": 0
},
"end": {
"line": 30,
"column": 2
}
},
"callee": {
"type": "MemberExpression",
"start": 522,
"end": 543,
"loc": {
"start": {
"line": 26,
"column": 0
},
"end": {
"line": 26,
"column": 21
}
},
"object": {
"type": "MemberExpression",
"start": 522,
"end": 536,
"loc": {
"start": {
"line": 26,
"column": 0
},
"end": {
"line": 26,
"column": 14
}
},
"object": {
"type": "Identifier",
"start": 522,
"end": 526,
"loc": {
"start": {
"line": 26,
"column": 0
},
"end": {
"line": 26,
"column": 4
},
"identifierName": "test"
},
"name": "test"
},
"property": {
"type": "Identifier",
"start": 527,
"end": 536,
"loc": {
"start": {
"line": 26,
"column": 5
},
"end": {
"line": 26,
"column": 14
},
"identifierName": "afterEach"
},
"name": "afterEach"
},
"computed": false
},
"property": {
"type": "Identifier",
"start": 537,
"end": 543,
"loc": {
"start": {
"line": 26,
"column": 15
},
"end": {
"line": 26,
"column": 21
},
"identifierName": "always"
},
"name": "always"
},
"computed": false
},
"arguments": [
{
"type": "StringLiteral",
"start": 544,
"end": 560,
"loc": {
"start": {
"line": 26,
"column": 22
},
"end": {
"line": 26,
"column": 38
}
},
"extra": {
"rawValue": "unmock imports",
"raw": "'unmock imports'"
},
"value": "unmock imports"
},
{
"type": "ArrowFunctionExpression",
"start": 562,
"end": 665,
"loc": {
"start": {
"line": 26,
"column": 40
},
"end": {
"line": 30,
"column": 1
}
},
"id": null,
"generator": false,
"expression": false,
"async": false,
"params": [
{
"type": "Identifier",
"start": 562,
"end": 563,
"loc": {
"start": {
"line": 26,
"column": 40
},
"end": {
"line": 26,
"column": 41
},
"identifierName": "t"
},
"name": "t"
}
],
"body": {
"type": "BlockStatement",
"start": 567,
"end": 665,
"loc": {
"start": {
"line": 26,
"column": 45
},
"end": {
"line": 30,
"column": 1
}
},
"body": [
{
"type": "VariableDeclaration",
"start": 571,
"end": 616,
"loc": {
"start": {
"line": 27,
"column": 2