Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: appengine/swarming/ui/test/js/test-alias.js

Issue 2419613002: Add basic swarming UI tests
Patch Set: Make sure symlink isn't followed for uploading Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 suite("swarming.alias", function() {
6 test("is defined", function() {
7 assert.isOk(swarming.alias)
8 assert.typeOf(swarming.alias, "object");
9 });
10 test("has all known aliases defined", function() {
11 swarming.alias.DIMENSIONS_WITH_ALIASES.forEach(function(a){
12 assert(swarming.alias.has(a));
13 });
14 });
15 test("applying alias of known type", function() {
16 assert.equal(swarming.alias.apply("foster", "device_type"), "NVIDIA Shield ( foster)");
17 assert.equal(swarming.alias.apply("10de:08a4", "gpu"), "NVIDIA GeForce 320M (10de:08a4)");
18 assert.equal(swarming.alias.apply("4", "battery_health"), "Dead (4)");
19 });
20 test("applying unknown alias of known type", function() {
21 assert.equal(swarming.alias.apply("fosterz", "device_type"), "fosterz");
22 assert.equal(swarming.alias.apply("10de:08a4z", "gpu"), "10de:08a4z");
23 assert.equal(swarming.alias.apply("4z", "battery_health"), "4z");
24 });
25 test("applying custom alias", function() {
26 assert.equal(swarming.alias.apply("alpha", "beta"), "beta (alpha)");
27 });
28
29 test("unapplying well formed alias", function() {
30 assert.equal(swarming.alias.unapply("NVIDIA Shield (foster)"), "foster");
31 assert.equal(swarming.alias.unapply("NVIDIA GeForce 320M (10de:08a4)"), "10d e:08a4");
32 assert.equal(swarming.alias.unapply("Dead (4)"), "4");
33 assert.equal(swarming.alias.unapply("beta (alpha)"), "alpha");
34 });
35 test("unapplying not an alias", function() {
36 assert.equal(swarming.alias.unapply("alpha-beta-gamma"), "alpha-beta-gamma") ;
37 assert.equal(swarming.alias.unapply(""), "");
38 assert.equal(swarming.alias.unapply(undefined), undefined);
39 assert.deepEqual(swarming.alias.unapply([1,2,3,4]), [1,2,3,4]);
40 });
41 });
OLDNEW
« no previous file with comments | « appengine/swarming/ui/test/common/test-pageable-data.html ('k') | appengine/swarming/ui/wct.conf.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698