UNPKG

12.7 kBJavaScriptView Raw
1/**
2 * Test case for apemanSrch.
3 * Runs with nodeunit.
4 */
5
6var https = require('https'),
7 injectmock = require('injectmock'),
8 assert = require('assert');
9var apemanSrch = require('../lib/apeman_srch.js');
10
11describe('apeman-srch', () => {
12
13 it('Run command.', (done) => {
14 injectmock(https, 'get', function (config, callback) {
15 var data = [{
16 name: 'apeman-task-mkdir',
17 full_name: 'apeman-task-labo/apeman-task-mkdir',
18 private: false,
19 description: 'apeman task to generate directories.',
20 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-mkdir',
21 fork: false
22 },
23 {
24 name: 'apeman-task-chmod',
25 full_name: 'apeman-task-labo/apeman-task-chmod',
26 private: false,
27 description: 'apeman task to change file permissions',
28 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-chmod',
29 fork: false
30 },
31 {
32 name: 'apeman-task-coz',
33 full_name: 'apeman-task-labo/apeman-task-coz',
34 private: false,
35 description: 'apeman task to render coz bud files.',
36 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-coz',
37 fork: false
38 },
39 {
40 name: 'apeman-task-copy',
41 full_name: 'apeman-task-labo/apeman-task-copy',
42 private: false,
43 description: 'apeman task to copy files.',
44 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-copy',
45 fork: false
46 },
47 {
48 name: 'apeman-task-concat',
49 full_name: 'apeman-task-labo/apeman-task-concat',
50 private: false,
51 description: 'apeman task to concat files.',
52 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-concat',
53 fork: false
54 },
55 {
56 name: 'apeman-task-nodeunit',
57 full_name: 'apeman-task-labo/apeman-task-nodeunit',
58 private: false,
59 description: 'apeman task to run nodeunit.',
60 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-nodeunit',
61 fork: false
62 },
63 {
64 name: 'apeman-task-mocha',
65 full_name: 'apeman-task-labo/apeman-task-mocha',
66 private: false,
67 description: 'apeman task to run mocha.',
68 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-mocha',
69 fork: false
70 },
71 {
72 name: 'apeman-task-karma',
73 full_name: 'apeman-task-labo/apeman-task-karma',
74 private: false,
75 description: 'apeman task to run karma.',
76 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-karma',
77 fork: false
78 },
79 {
80 name: 'apeman-task-jade',
81 full_name: 'apeman-task-labo/apeman-task-jade',
82 private: false,
83 description: 'apeman task to compile jade files.',
84 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-jade',
85 fork: false
86 },
87 {
88 name: 'apeman-task-symlink',
89 full_name: 'apeman-task-labo/apeman-task-symlink',
90 private: false,
91 description: 'apeman task to create symlink.',
92 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-symlink',
93 fork: false
94 },
95 {
96 name: 'apeman-task-task',
97 full_name: 'apeman-task-labo/apeman-task-task',
98 private: false,
99 description: 'apeman task to run other apeman tasks.',
100 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-task',
101 fork: false
102 },
103 {
104 name: 'apeman-task-execcli',
105 full_name: 'apeman-task-labo/apeman-task-execcli',
106 private: false,
107 description: 'apeman task to execute cli command.',
108 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-execcli',
109 fork: false
110 },
111 {
112 name: 'apeman-task-scss',
113 full_name: 'apeman-task-labo/apeman-task-scss',
114 private: false,
115 description: 'apeman task to compile sass.',
116 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-scss',
117 fork: false
118 },
119 {
120 name: 'apeman-task-versionup',
121 full_name: 'apeman-task-labo/apeman-task-versionup',
122 private: false,
123 description: 'apeman task to increment package version.',
124 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-versionup',
125 fork: false
126 },
127 {
128 name: 'apeman-task-taggit',
129 full_name: 'apeman-task-labo/apeman-task-taggit',
130 private: false,
131 description: 'apeman task to create git tag.',
132 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-taggit',
133 fork: false
134 },
135 {
136 name: 'apeman-task-jsdoc',
137 full_name: 'apeman-task-labo/apeman-task-jsdoc',
138 private: false,
139 description: 'apeman task to generate jsdoc.',
140 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-jsdoc',
141 fork: false
142 },
143 {
144 name: 'apeman-task-coverage',
145 full_name: 'apeman-task-labo/apeman-task-coverage',
146 private: false,
147 description: 'apeman task to measure coverage.',
148 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-coverage',
149 fork: false
150 },
151 {
152 name: 'apeman-task-fmtjson',
153 full_name: 'apeman-task-labo/apeman-task-fmtjson',
154 private: false,
155 description: 'apeman task to format json files.',
156 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-fmtjson',
157 fork: false
158 },
159 {
160 name: 'apeman-task-apiguide',
161 full_name: 'apeman-task-labo/apeman-task-apiguide',
162 private: false,
163 description: 'apeman task to generate apiguide',
164 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-apiguide',
165 fork: false
166 },
167 {
168 name: 'apeman-task-bower',
169 full_name: 'apeman-task-labo/apeman-task-bower',
170 private: false,
171 description: 'apeman task to install bower components.',
172 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-bower',
173 fork: false
174 },
175 {
176 name: 'apeman-task-update',
177 full_name: 'apeman-task-labo/apeman-task-update',
178 private: false,
179 description: 'apeman task to update package dependencies.',
180 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-update',
181 fork: false
182 },
183 {
184 name: 'apeman-task-sure',
185 full_name: 'apeman-task-labo/apeman-task-sure',
186 private: false,
187 description: 'apeman task to ask sure',
188 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-sure',
189 fork: false
190 },
191 {
192 name: 'apeman-task-push',
193 full_name: 'apeman-task-labo/apeman-task-push',
194 private: false,
195 description: 'apeman task to push git.',
196 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-push',
197 fork: false
198 },
199 {
200 name: 'apeman-task-publish',
201 full_name: 'apeman-task-labo/apeman-task-publish',
202 private: false,
203 description: 'apeman task to publish npm package.',
204 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-publish',
205 fork: false
206 },
207 {
208 name: 'apeman-task-install',
209 full_name: 'apeman-task-labo/apeman-task-install',
210 private: false,
211 description: 'apeman task to install npm packages.',
212 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-install',
213 fork: false
214 },
215 {
216 name: 'apeman-task-tmpl',
217 full_name: 'apeman-task-labo/apeman-task-tmpl',
218 private: false,
219 description: 'apeman task to run apeman tmpl command.',
220 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-tmpl',
221 fork: false
222 },
223 {
224 name: 'apeman-task-codeclimate',
225 full_name: 'apeman-task-labo/apeman-task-codeclimate',
226 private: false,
227 description: 'apeman task to send test report to codeclimate.com',
228 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-codeclimate',
229 fork: false
230 },
231 {
232 name: 'apeman-task-clean',
233 full_name: 'apeman-task-labo/apeman-task-clean',
234 private: false,
235 description: 'apeman task to delete files.',
236 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-clean',
237 fork: false
238 },
239 {
240 name: 'apeman-task-jsx',
241 full_name: 'apeman-task-labo/apeman-task-jsx',
242 private: false,
243 description: 'apeman task to compile jsx files.',
244 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-jsx',
245 fork: false
246 },
247 {
248 name: 'apeman-task-browserify',
249 full_name: 'apeman-task-labo/apeman-task-browserify',
250 private: false,
251 description: 'apeman task to run browserify.',
252 url: 'https://api.github.com/repos/apeman-task-labo/apeman-task-browserify',
253 fork: false
254 }
255 ];
256 var content = JSON.stringify(data);
257 var res = {
258 on: function (ev, callback) {
259 switch (ev) {
260 case 'data':
261 setTimeout(() => {
262 callback(content);
263 }, 5);
264 break;
265 case 'end':
266 setTimeout(() => {
267 callback(null);
268 }, 20);
269 }
270 },
271 statusCode: 200
272 };
273 callback(res);
274 });
275 apemanSrch("pu", {type: 'task'}, function (err) {
276 assert.ifError(err);
277 done();
278 });
279 });
280});
281