Skip to content

Commit c7ecdf2

Browse files
committed
test: First test for tymly add-model
1 parent 282485e commit c7ecdf2

21 files changed

Lines changed: 752 additions & 9 deletions

test/add-model.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/* eslint-env mocha */
2+
3+
const fail = require('assert').fail
4+
5+
const bddStdin = require('bdd-stdin')
6+
const stdMocks = require('std-mocks')
7+
const path = require('path')
8+
const fs = require('fs-extra')
9+
10+
const helpers = require('./test-helpers')
11+
12+
const addModel = require('../lib/actions').addModelAction
13+
14+
describe('tymly add-model', () => {
15+
const suiteName = 'add-model'
16+
let outputPath
17+
18+
before(() => {
19+
outputPath = helpers.prepareFixture(suiteName)
20+
})
21+
22+
const tests = {
23+
'named-pizza': [
24+
'A pizza',
25+
'name',
26+
'string',
27+
'Y',
28+
'Y',
29+
'',
30+
'Y'
31+
]
32+
}
33+
34+
for (const [name, params] of Object.entries(tests)) {
35+
it(name, async () => {
36+
stdMocks.use()
37+
38+
const dirName = name.replace(/ /g, '-')
39+
40+
bddStdin(
41+
...params.map(p => `${p}\n`)
42+
)
43+
44+
await addModel()
45+
46+
stdMocks.restore()
47+
helpers.compareOutputs(suiteName, dirName)
48+
})
49+
}
50+
})
51+
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
# Compiled source #
2+
###################
3+
*.com
4+
*.class
5+
*.dll
6+
*.exe
7+
*.o
8+
*.so
9+
10+
# Packages #
11+
############
12+
# it's better to unpack these files and commit the raw source
13+
# git has its own built in compression methods
14+
*.7z
15+
*.dmg
16+
*.gz
17+
*.iso
18+
*.jar
19+
*.rar
20+
*.tar
21+
*.zip
22+
23+
# Logs and databases #
24+
######################
25+
*.log
26+
27+
*.sqlite
28+
29+
## Node ###
30+
~*
31+
.~*
32+
\#*
33+
34+
# Logs
35+
logs
36+
*.log
37+
npm-debug.log*
38+
39+
# Runtime data
40+
pids
41+
*.pid
42+
*.seed
43+
*.pid.lock
44+
45+
# Directory for instrumented libs generated by jscoverage/JSCover
46+
lib-cov
47+
48+
# Coverage directory used by tools like istanbul
49+
coverage
50+
51+
# nyc test coverage
52+
.nyc_output
53+
54+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
55+
.grunt
56+
57+
# node-waf configuration
58+
.lock-wscript
59+
60+
# Compiled binary addons (http://nodejs.org/api/addons.html)
61+
build/Release
62+
63+
# Dependency directories
64+
node_modules
65+
jspm_packages
66+
67+
# Optional npm cache directory
68+
.npm
69+
70+
# Optional eslint cache
71+
.eslintcache
72+
73+
# Optional REPL history
74+
.node_repl_history
75+
76+
# Output of 'npm pack'
77+
*.tgz
78+
79+
# Yarn Integrity file
80+
.yarn-integrity
81+
82+
83+
## IDE things ##
84+
85+
# Webstorm
86+
.idea
87+
88+
# Eclipse:
89+
90+
.project
91+
.metadata
92+
bin/
93+
tmp/
94+
*.tmp
95+
*.bak
96+
*.swp
97+
*~.nib
98+
local.properties
99+
.settings/
100+
.loadpath
101+
.recommenders
102+
103+
104+
scratch.txt
105+
package-lock.json
106+
107+
output/
108+
109+
# Ignore Rush temporary files
110+
/common/temp/**
111+
112+
package-deps.json
113+
114+
.yo-rc.json
115+
116+
lerna-debug.log
117+
118+
TEST-result.xml
119+
.gradle/
120+
.embedpostgresql/
121+
build/
122+
123+
# Windows thumbnail cache files
124+
Thumbs.db
125+
ehthumbs.db
126+
ehthumbs_vista.db
127+
128+
# Dump file
129+
*.stackdump
130+
131+
# Folder config file
132+
[Dd]esktop.ini
133+
134+
# Recycle Bin used on file shares
135+
$RECYCLE.BIN/
136+
137+
# Windows Installer files
138+
*.cab
139+
*.msi
140+
*.msix
141+
*.msm
142+
*.msp
143+
144+
# Windows shortcuts
145+
*.lnk
146+
147+
# OS generated files #
148+
######################
149+
.DS_Store
150+
.DS_Store?
151+
._*
152+
.Spotlight-V100
153+
.Trashes
154+
ehthumbs.db
155+
Thumbs.db
156+
.LSOverride
157+
158+
# Icon must end with two \r
159+
Icon
160+
161+
162+
# Thumbnails
163+
._*
164+
165+
# Files that might appear in the root of a volume
166+
.DocumentRevisions-V100
167+
.fseventsd
168+
.Spotlight-V100
169+
.TemporaryItems
170+
.Trashes
171+
.VolumeIcon.icns
172+
.com.apple.timemachine.donotpresent
173+
174+
# Directories potentially created on remote AFP share
175+
.AppleDB
176+
.AppleDesktop
177+
Network Trash Folder
178+
Temporary Items
179+
.apdisk
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{
2+
"branch": "master",
3+
"analyzeCommits": {
4+
"preset": "angular",
5+
"releaseRules": [
6+
{
7+
"type": "build",
8+
"scope": "deps",
9+
"release": "minor"
10+
}
11+
]
12+
},
13+
"verifyConditions": [
14+
"@semantic-release/changelog",
15+
"@semantic-release/npm",
16+
"@semantic-release/git"
17+
],
18+
"generateNotes": {
19+
"preset": "metahub"
20+
},
21+
"prepare": [
22+
{
23+
"path": "@semantic-release/changelog",
24+
"changelogFile": "CHANGELOG.md"
25+
},
26+
{
27+
"path": "@semantic-release/git",
28+
"assets": [
29+
"CHANGELOG.md"
30+
]
31+
},
32+
"@semantic-release/npm"
33+
],
34+
"publish": [
35+
"@semantic-release/npm",
36+
"@semantic-release/github"
37+
],
38+
"success": [
39+
"@semantic-release/github"
40+
],
41+
"fail": [
42+
"@semantic-release/github"
43+
]
44+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
language: node_js
2+
notifications:
3+
email: false
4+
node_js:
5+
- lts/*
6+
sudo: false
7+
dist: trusty
8+
branches:
9+
only:
10+
- master
11+
env:
12+
global:
13+
- TIMEOUT=15000
14+
install:
15+
- travis_retry npm install
16+
test:
17+
- npm test
18+
before_deploy:
19+
- npm run coverage
20+
deploy:
21+
- provider: script
22+
skip_cleanup: true
23+
script: npx semantic-release
24+
on:
25+
branch: master
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 West Midlands Fire Service
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# tymly-pizza-blueprint
2+
3+
> For ordering delicious pizza
4+
5+
## Install
6+
7+
``` bash
8+
npm install @wmfs/tymly-pizza-blueprint --save
9+
```
10+
11+
## <a name="license"></a>License
12+
13+
MIT
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "tymly-pizza-blueprint",
3+
"version": "1.0.0",
4+
"label": "",
5+
"organisation": "West Midlands Fire Service",
6+
"author": "Jane Doe",
7+
"description": "For ordering delicious pizza",
8+
"categories": []
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// placeholder, here simply so we can resolve the module
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"title": "pizza",
3+
"description": "A pizza",
4+
"primaryKey": [
5+
"name"
6+
],
7+
"properties": {
8+
"name": {
9+
"type": "string"
10+
}
11+
},
12+
"required": [
13+
"name"
14+
]
15+
}

0 commit comments

Comments
 (0)